| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- @startuml
- top to bottom direction
- skinparam packageStyle rectangle
- skinparam linetype ortho
- package "Database" {
- class DbConfig {
- +CONNECTION_STRING : string
- }
- class DatabaseManager {
- +CreateConnection() : NpgsqlConnection
- }
- }
- package "Models" {
- class User {
- +Id : int
- +Username : string
- +PasswordHash : string
- +Email : string
- +CreatedAt : DateTime
- }
- class Book {
- +Id : int
- +Title : string
- +Author : string
- +PublicationYear : int
- +OwnerId : int
- +CreatedAt : DateTime
- }
- }
- package "Repositories" {
- interface IUserRepository {
- +Create(user : User) : int
- +GetAll() : IEnumerable<User>
- +GetById(id : int) : User
- +Update(user : User) : bool
- +Delete(id : int) : bool
- }
- interface IBookRepository {
- +Create(book : Book) : int
- +GetAll() : IEnumerable<Book>
- +GetById(id : int) : Book
- +Update(book : Book) : bool
- +Delete(id : int) : bool
- }
- class UserRepository {
- -_databaseManager : DatabaseManager
- +Create(user : User) : int
- +GetAll() : IEnumerable<User>
- +GetById(id : int) : User
- +Update(user : User) : bool
- +Delete(id : int) : bool
- }
- class BookRepository {
- -_databaseManager : DatabaseManager
- +Create(book : Book) : int
- +GetAll() : IEnumerable<Book>
- +GetById(id : int) : Book
- +Update(book : Book) : bool
- +Delete(id : int) : bool
- }
- }
- package "Utils" {
- class PasswordHasher {
- +HashPassword(password : string) : string
- +VerifyPassword(password : string, hash : string) : bool
- }
- class LoggerConfigurator {
- +Configure()
- }
- }
- package "Tests" {
- class DatabaseTests {
- +Database_Should_Connect_Successfully()
- }
- class UserRepositoryTests {
- +Create_Should_Add_User()
- +GetAll_Should_Return_Users()
- +Update_Should_Modify_User()
- +Delete_Should_Remove_User()
- }
- class TestHelper {
- +CleanupUsers()
- }
- }
- UserRepository --> DatabaseManager
- BookRepository --> DatabaseManager
- UserRepository ..|> IUserRepository
- BookRepository ..|> IBookRepository
- Book --> User : owner_id
- UserRepository --> User
- BookRepository --> Book
- UserRepositoryTests --> IUserRepository
- DatabaseTests --> DatabaseManager
- TestHelper --> DatabaseManager
- DbConfig <-- DatabaseManager
- @enduml
|