siga

Sistema Interativo de Gerência de Atividades.
Log | Files | Refs | README | LICENSE

sequencia.puml (1791B)


      1 @startuml sequencia
      2 title SIGA - Sequência: cadastrar evento (POST /event)
      3 
      4 autonumber
      5 actor Organizador as Org
      6 participant "Server\n(event_registration)" as Server
      7 participant "Auth\n(auth.zig)" as Gw
      8 participant "auth\n(Go)" as AuthSvc
      9 database "sessions\n(db.db)" as SessDb
     10 participant "Repository\n(event_registration)" as Repo
     11 database "events.db" as EvDb
     12 
     13 Org -> Server : POST /event\nAuthorization: Bearer <uuid>\n{"name": "Semana Acadêmica"}
     14 activate Server
     15 Server -> Server : requireAuth(req, res)
     16 Server -> Gw : authenticate(header)
     17 Gw -> Gw : tokenFromHeader(header)\nisUuid(token)
     18 
     19 alt token ausente ou malformado
     20   Gw --> Server : missing_token
     21   Server --> Org : 401 {"error": "missing or malformed token"}
     22 else token bem formado
     23   Gw -> AuthSvc : GET /{uuid}
     24   alt auth acessível
     25     AuthSvc -> SessDb : SessionUsername(token)
     26     SessDb --> AuthSvc : linha / sem linha
     27     AuthSvc --> Gw : 200 {"Username": ...} ou 401
     28   else auth fora do ar
     29     Gw -> Gw : falha de conexão
     30   end
     31 
     32   alt 401: sessão não existe
     33     Gw --> Server : invalid_token
     34     Server --> Org : 401 {"error": "invalid token"}
     35   else falha de conexão ou status inesperado
     36     Gw --> Server : unavailable
     37     Server --> Org : 503 {"error": "auth service unavailable"}
     38   else 200
     39     Gw --> Server : authenticated
     40     Server -> Server : req.json(PostRequest)
     41     alt nome vazio ou > 128 bytes
     42       Server --> Org : 400 {"error": "name is empty" | "name too big"}
     43     else nome válido
     44       Server -> Repo : insertByName(name)
     45       activate Repo
     46       Repo -> EvDb : insert into events(name) returning id
     47       EvDb --> Repo : id
     48       Repo --> Server : id
     49       deactivate Repo
     50       Server --> Org : 201 Location: /event/{id}\n{"id": id, "name": name}
     51     end
     52   end
     53 end
     54 deactivate Server
     55 
     56 @enduml