-
Notifications
You must be signed in to change notification settings - Fork 0
/
diagaram_sec_get_dating.puml
84 lines (69 loc) · 2.24 KB
/
diagaram_sec_get_dating.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@startuml
actor Client
participant "Context" as ctx
participant "UseCase" as usecase
participant "SwipeRepository" as swipeRepo
participant "UserRepository" as userRepo
database "Database" as db
Client -> usecase: GetDatings(ctx)
activate usecase
usecase -> usecase: now := time.Now()
usecase -> ctx: GetValue("user_id")
return strValue
usecase -> swipeRepo: GetCountSwipe(ctx, GetSwipeReq{UserId, Date})
activate swipeRepo
swipeRepo -> db: Query Swipe Count
return count
deactivate swipeRepo
alt if count >= 10 and not verified
usecase -> userRepo: GetUserById(ctx, UserId)
activate userRepo
userRepo -> db: Query User Data
return data
deactivate userRepo
usecase -> usecase: Return Error "swipe today is done"
else if count < 10 or verified
usecase -> swipeRepo: GetSwipeAbleUser(ctx, GetSwipeReq{UserId, Date})
activate swipeRepo
swipeRepo -> db: Query Swipeable Users
return user
deactivate swipeRepo
usecase --> Client: Return user
end
Memperbaiki sequence diagram PlantUML untuk fungsi GetDatings, saya akan menyesuaikan bagian akhir diagram untuk memastikan bahwa penutupan aktivasi usecase dan pengembalian user ke Client dilakukan dengan benar. Berikut adalah versi yang diperbaiki:
plantuml
Copy code
@startuml
actor Client
participant "Context" as ctx
participant "UseCase" as usecase
participant "SwipeRepository" as swipeRepo
participant "UserRepository" as userRepo
database "Database" as db
Client -> usecase: GetDatings(ctx)
activate usecase
usecase -> usecase: now := time.Now()
usecase -> ctx: GetValue("user_id")
return strValue
usecase -> swipeRepo: GetCountSwipe(ctx, GetSwipeReq{UserId, Date})
activate swipeRepo
swipeRepo -> db: Query Swipe Count
return count
deactivate swipeRepo
alt if count >= 10 and not verified
usecase -> userRepo: GetUserById(ctx, UserId)
activate userRepo
userRepo -> db: Query User Data
return data
deactivate userRepo
usecase --> Client: Return Error "swipe today is done"
else if count < 10 or verified
usecase -> swipeRepo: GetSwipeAbleUser(ctx, GetSwipeReq{UserId, Date})
activate swipeRepo
swipeRepo -> db: Query Swipeable Users
return user
deactivate swipeRepo
usecase --> Client: Return user
end
deactivate usecase
@enduml