|
154 | 154 | sequenceDiagram |
155 | 155 | %% Participants |
156 | 156 | participant User |
157 | | - participant Contract |
158 | | - participant Proxy |
159 | | - participant Storage |
160 | | - participant Events |
161 | | -
|
162 | | - %% Initial deployment |
163 | | - User ->> Contract: deploy() |
164 | | - activate Contract |
165 | | - Contract ->> Proxy: initialize() |
166 | | - activate Proxy |
167 | | - Proxy -->> Contract: success |
168 | | - deactivate Proxy |
169 | | - Contract -->> User: deployed |
170 | | - deactivate Contract |
171 | | -
|
172 | | - %% Function call with validation |
173 | | - User ->> Contract: execute(data) |
174 | | - activate Contract |
175 | | - |
176 | | - alt Valid Input |
177 | | - Contract ->> Storage: store(data) |
178 | | - Storage -->> Contract: success |
179 | | - Contract ->> Events: emit Status |
180 | | - else |
181 | | - Contract ->> Events: emit Error |
182 | | - Contract --x User: revert |
| 157 | + participant Frontend |
| 158 | + participant AuthService |
| 159 | + participant DB |
| 160 | + participant EmailService |
| 161 | +
|
| 162 | + %% Initial interaction |
| 163 | + User ->> Frontend: click "Sign Up" |
| 164 | + activate Frontend |
| 165 | +
|
| 166 | + %% Form submission |
| 167 | + Frontend ->> AuthService: createUser(name, email, password) |
| 168 | + deactivate Frontend |
| 169 | + activate AuthService |
| 170 | +
|
| 171 | + %% Backend validation |
| 172 | + AuthService ->> AuthService: validateInput() |
| 173 | + AuthService ->> DB: checkIfUserExists(email) |
| 174 | + activate DB |
| 175 | + DB -->> AuthService: userNotFound |
| 176 | + deactivate DB |
| 177 | +
|
| 178 | + %% Create user |
| 179 | + AuthService ->> DB: insertUser(data) |
| 180 | + activate DB |
| 181 | + DB -->> AuthService: userId |
| 182 | + deactivate DB |
| 183 | +
|
| 184 | + %% Send welcome email |
| 185 | + AuthService ->> EmailService: sendWelcomeEmail(email) |
| 186 | + activate EmailService |
| 187 | + EmailService -->> AuthService: emailSent |
| 188 | + deactivate EmailService |
| 189 | +
|
| 190 | + %% Auth token creation |
| 191 | + AuthService ->> AuthService: generateJWT(userId) |
| 192 | + AuthService -->> Frontend: token, userData |
| 193 | + deactivate AuthService |
| 194 | + activate Frontend |
| 195 | +
|
| 196 | + %% Frontend confirmation |
| 197 | + Frontend ->> User: show success screen |
| 198 | + deactivate Frontend |
| 199 | +
|
| 200 | + %% Conditionals |
| 201 | + alt EmailService Down |
| 202 | + activate AuthService |
| 203 | + AuthService ->> AuthService: logError("email failed") |
| 204 | + deactivate AuthService |
| 205 | + else Email sent successfully |
| 206 | + activate AuthService |
| 207 | + AuthService ->> DB: updateUser(emailSent=true) |
| 208 | + activate DB |
| 209 | + DB -->> AuthService: OK |
| 210 | + deactivate DB |
| 211 | + deactivate AuthService |
183 | 212 | end |
184 | | - |
185 | | - deactivate Contract |
186 | 213 |
|
187 | | - %% Optional logging |
188 | | - opt Debug Mode |
189 | | - Contract ->> Events: emit Debug |
| 214 | + %% Optional block |
| 215 | + opt Remember Me |
| 216 | + activate Frontend |
| 217 | + Frontend ->> LocalStorage: store token |
| 218 | + deactivate Frontend |
190 | 219 | end |
191 | 220 |
|
192 | | - %% Retry logic |
193 | | - loop Max 3 attempts |
194 | | - Contract ->> Storage: retry() |
| 221 | + %% Looping flow |
| 222 | + loop Retry on Failure (max 3 times) |
| 223 | + activate Frontend |
| 224 | + Frontend ->> AuthService: createUser(...) |
| 225 | + deactivate Frontend |
| 226 | + activate AuthService |
| 227 | + AuthService ->> DB: checkIfUserExists(...) |
| 228 | + DB -->> AuthService: ... |
| 229 | + deactivate AuthService |
195 | 230 | end |
196 | 231 |
|
197 | | - Note right of Contract: Handles core logic |
198 | | - Note over Storage,Events: Persistent state |
| 232 | + %% Note annotations |
| 233 | + Note right of User: Enters name, email and password |
| 234 | + Note left of AuthService: Handles all signup logic |
| 235 | + Note over EmailService, DB: Sends confirmation and updates user record |
| 236 | +
|
| 237 | + %% Styling (not officially supported in sequenceDiagram yet but shown for completeness) |
| 238 | + %% classDef service fill:#bbf,stroke:#333,stroke-width:2px |
| 239 | + %% class AuthService,EmailService,DB service |
199 | 240 | ``` |
200 | 241 |
|
201 | 242 | VALIDATION CHECKLIST (VERIFY BEFORE RETURNING): |
|
0 commit comments