Fix and cleanup for Events.WebApi

This commit is contained in:
Boris Milašinović
2026-05-11 23:49:25 +02:00
parent 4fb3de19f6
commit b66d05c298
22 changed files with 572 additions and 113 deletions

View File

@@ -0,0 +1,146 @@
workspace "Events-WebApi" "Structurizr model za rješenje Events-WebApi" {
model {
auth0 = softwareSystem "Auth0" "Vanjski identity provider za prijavu i JWT tokene." {
tags "External", "Auth"
}
postgres = softwareSystem "PostgreSQL" "Relacijska baza podataka za domenu događaja." {
tags "External", "Database"
}
rabbitmq = softwareSystem "RabbitMQ" "Sabirnica poruka za asinkronu razmjenu događaja." {
tags "External", "MessageBus"
}
eventsSystem = softwareSystem "Events-WebApi" "Rješenje za upravljanje događajima, prijavama i generiranim datotekama." {
clientApp = container "ClientApp" "" "Vue 3 + Vite" {
tags "Frontend"
}
webApi = container "WebAPI" "CRUD servisi" "ASP.NET Core Web API" {
tags "API", "WebAPI"
}
filesApi = container "FilesAPI" "API za sinkronizaciju i isporuku PDF/XLSX datoteka." "ASP.NET Core Web API" {
tags "API", "FilesAPI"
}
clientApp -> auth0 "Prijava i dohvat pristupnog tokena"
clientApp -> webApi "CRUD operacije i registracija za događaj" "JSON/HTTPS"
clientApp -> filesApi "Preuzimanje certifikata i Excel izvoza" "HTTPS"
webApi -> auth0 "Validira JWT tokene" "OAuth2/JWT"
webApi -> postgres "Čita i zapisuje događaje, osobe, sportove i prijave" "EF Core/Npgsql"
webApi -> rabbitmq "Objavljuje RegistrationCreated/Updated/Deleted" "MassTransit/AMQP"
rabbitmq -> filesApi "Isporučuje registration događaje consumerima" "MassTransit/AMQP"
filesApi -> postgres "Čita podatke za generiranje datoteka" "EF Core/Npgsql"
}
}
views {
container eventsSystem "Containers" {
include clientApp
include webApi
include filesApi
include auth0
include postgres
include rabbitmq
animation {
clientApp
webApi postgres auth0
rabbitmq
filesApi
}
}
dynamic eventsSystem "RegistrationFlow" "Tok registracije za događaj" {
clientApp -> webApi "Korisnik u ClientApp šalje prijavu za događaj"
webApi -> auth0 "Validacija pristupnog tokena"
webApi -> postgres "Spremanje registracije u bazu"
webApi -> rabbitmq "Objava događaja RegistrationCreated"
rabbitmq -> filesApi "Isporuka događaja RegistrationCreated"
filesApi -> postgres "Dohvat podataka za certifikat i Excel"
}
theme default
styles {
element "Container" {
background #ffffff
color #222222
stroke #444444
fontSize 34
}
element "Frontend" {
shape WebBrowser
background #ffffff
color #1565c0
stroke #42a5f5
strokeWidth 3
fontSize 36
}
element "API" {
shape Hexagon
background #ffffff
strokeWidth 3
fontSize 36
}
element "WebAPI" {
color #1565c0
stroke #42a5f5
}
element "FilesAPI" {
color #2e7d32
stroke #66bb6a
}
element "Database" {
shape Cylinder
background #ffffff
color #1565c0
stroke #42a5f5
strokeWidth 3
fontSize 34
description false
}
element "MessageBus" {
shape Pipe
background #fff8e1
color #8d6e63
stroke #ff9800
strokeWidth 3
width 760
height 140
fontSize 34
description false
}
element "External" {
opacity 85
}
element "Auth" {
background #ffffff
color #c62828
stroke #e53935
strokeWidth 3
fontSize 34
}
relationship "Relationship" {
color #666666
thickness 2
fontSize 34
}
}
}
}

View File

@@ -0,0 +1,184 @@
workspace "Events-WebApi CRUD Flow" "Structurizr model za tipični CRUD tok u WebAPI-ju" {
model {
postgres = softwareSystem "PostgreSQL" "" {
tags "Database"
}
rabbitmq = softwareSystem "RabbitMQ" "" {
tags "MessageBus"
}
eventsSystem = softwareSystem "Events-WebApi" "Rješenje za upravljanje događajima i prijavama." {
clientApp = container "ClientApp" "" "Vue 3 + Vite" {
tags "Frontend"
}
webApi = container "WebAPI" "CRUD servisi" "ASP.NET Core Web API" {
tags "API"
controller = component "Controller" "Ulazna točka za CRUD nad prijavama." "ASP.NET Core Controller" {
tags "Controller"
}
validation = component "Validation" "Validacija DTO-a i poslovnih pravila prije obrade." "MediatR Pipeline + FluentValidation" {
tags "Validation"
}
mediator = component "MediatR" "Prosljeđuje command odgovarajućem handleru." "Mediator" {
tags "Mediator"
}
handler = component "Handler" "Obrada Add/Update/Delete zahtjeva i objava događaja." "Command Handler" {
tags "Handler"
}
dbContext = component "DbContext" "EF Core pristup tablicama registration, person, event i sport." "DbContext" {
tags "DbContext"
}
publishEndpoint = component "Publisher" "Objava događaja RegistrationCreated/Updated/Deleted." "MassTransit publisher" {
tags "Publisher"
}
controller -> validation "Pokreće validaciju kroz pipeline"
validation -> mediator "Prosljeđuje valjani zahtjev"
mediator -> handler "Poziva command handler"
handler -> dbContext "Čita i zapisuje podatke"
handler -> publishEndpoint "Objavljuje događaj nakon promjene registracije"
}
clientApp -> controller "Šalje CRUD zahtjev" "JSON/HTTPS"
dbContext -> postgres "Persistira promjene" "EF Core/Npgsql"
publishEndpoint -> rabbitmq "Šalje poruku" "AMQP"
}
}
views {
component webApi "WebApiComponents" {
include clientApp
include controller
include validation
include mediator
include handler
include dbContext
include publishEndpoint
include postgres
include rabbitmq
}
dynamic webApi "CreateRegistrationFlow" "Tipični CRUD tok: kreiranje prijave za događaj" {
clientApp -> controller "Korisnik šalje prijavu za događaj"
controller -> validation "Provjera DTO-a i pravila"
validation -> mediator "Valjan zahtjev ide dalje"
mediator -> handler "Poziv AddCommand handlera"
handler -> dbContext "Spremanje registracije"
dbContext -> postgres "INSERT registration"
handler -> publishEndpoint "Objava RegistrationCreated"
publishEndpoint -> rabbitmq "Slanje događaja"
autolayout lr
}
theme default
styles {
element "Element" {
background #ffffff
color #222222
stroke #444444
fontSize 40
}
element "Frontend" {
shape WebBrowser
color #1565c0
stroke #42a5f5
strokeWidth 3
fontSize 42
}
element "API" {
shape Hexagon
color #1565c0
stroke #42a5f5
strokeWidth 3
fontSize 42
}
element "Controller" {
shape RoundedBox
color #1e88e5
stroke #64b5f6
strokeWidth 3
fontSize 40
}
element "Validation" {
shape RoundedBox
color #6a1b9a
stroke #ab47bc
strokeWidth 3
fontSize 40
}
element "Mediator" {
shape RoundedBox
color #00897b
stroke #4db6ac
strokeWidth 3
fontSize 40
}
element "Handler" {
shape RoundedBox
color #2e7d32
stroke #66bb6a
strokeWidth 3
fontSize 40
}
element "DbContext" {
shape RoundedBox
color #ef6c00
stroke #ffb74d
strokeWidth 3
fontSize 40
}
element "Publisher" {
shape RoundedBox
color #5d4037
stroke #a1887f
strokeWidth 3
fontSize 40
}
element "Database" {
shape Cylinder
color #1565c0
stroke #42a5f5
strokeWidth 3
fontSize 40
description false
}
element "MessageBus" {
shape Pipe
background #fff8e1
color #8d6e63
stroke #ff9800
strokeWidth 3
width 760
height 140
fontSize 40
description false
}
relationship "Relationship" {
color #666666
thickness 2
fontSize 36
}
}
}
}