-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookingSequence.puml
115 lines (106 loc) · 4.47 KB
/
bookingSequence.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
@startuml Manage Booking
title "Manage Booking"
participant "Client" as client
participant "<<javaScript>>\n:server" as server
participant "<<router>>\n:booking" as booking
participant "<<middleware>>\n:auth" as middleware
participant "<<service>>\n:jwt" as jwt
participant "<<controllers>>\n:booking" as BookingControllers
participant "<<model>>\n:booking" as BookingModel
participant "<<model>>\n:user" as modelUser
database "<<MongoDB>>\n:booking" as bookingDatabase
database "<<MongoDB>>\n:dentist" as dentistDatebase
database "<<MongoDB>>\n:user" as userDatabase
client->server ++:req.post('/bookings')
server->booking --++:app.use('api/v1/bookings',bookings)
booking->middleware ++:protect
middleware->jwt ++:verify(token,secret)
jwt-->middleware --: decoded
middleware->modelUser ++:findById(decoded.id)
modelUser -> userDatabase ++:find(_id:decoded.id)
userDatabase --> modelUser --:user
modelUser-->middleware --:req.user
middleware-->booking --:next
booking -> BookingControllers --++:addBooking
BookingControllers->BookingModel ++:findById(req.params.dentistID)
BookingModel ->dentistDatebase ++: DentistSchema
dentistDatebase --> BookingModel --: dentist
BookingControllers <-- BookingModel --:dentist
BookingControllers->client :response
BookingControllers->BookingModel ++:find({ user: req.user.id })
BookingModel ->bookingDatabase ++:BookingSchema
bookingDatabase --> BookingModel --:userBooking
BookingModel --> BookingControllers --:userBooking
BookingControllers->BookingModel ++:create(req.body)
BookingModel->bookingDatabase ++:BookingSchema
bookingDatabase-->BookingModel --:booking
BookingModel-->BookingControllers --:booking
BookingControllers -> client --: response
client->server ++:req.get('/bookings')
server->booking --++:app.use('api/v1/bookings',bookings)
booking->middleware ++:protect
middleware->jwt ++:verify(token,secret)
jwt-->middleware --: decoded
middleware->modelUser ++:findById(decoded.id)
modelUser -> userDatabase ++:find(_id:decoded.id)
userDatabase --> modelUser --:user
modelUser-->middleware --:req.user
middleware-->booking --:next
booking->BookingControllers --++:getBookings
BookingControllers->BookingModel ++:find()
BookingModel->bookingDatabase ++:BookingSchema
bookingDatabase-->BookingModel --:booking
BookingModel-->BookingControllers --:booking
BookingControllers->client --:response
client->server ++:req.get('/bookings/:id')
server->booking --++:app.use('api/v1/bookings',bookings)
booking->middleware ++:protect
middleware->jwt ++:verify(token,secret)
jwt-->middleware --: decoded
middleware->modelUser ++:findById(decoded.id)
modelUser -> userDatabase ++:find(_id:decoded.id)
userDatabase --> modelUser --:user
modelUser-->middleware --:req.user
middleware-->booking --:next
booking->BookingControllers --++:getBookings
BookingControllers->BookingModel ++:findById(req.param.id)
BookingModel->bookingDatabase ++:BookingSchema
bookingDatabase-->BookingModel --:booking
BookingModel-->BookingControllers --:booking
BookingControllers->client --:response
client->server ++:req.put('/bookings/:id')
server->booking --++:app.use('api/v1/bookings',bookings)
booking->middleware ++:protect
middleware->jwt ++:verify(token,secret)
jwt-->middleware --: decoded
middleware->modelUser ++:findById(decoded.id)
modelUser -> userDatabase ++:find(_id:decoded.id)
userDatabase --> modelUser --:user
modelUser-->middleware --:req.user
middleware-->booking --:next
booking->BookingControllers --++:updateBooking
BookingControllers->BookingModel ++:findById(req.param.id)
BookingModel->bookingDatabase ++:BookingSchema
bookingDatabase-->BookingModel --:booking
BookingModel-->BookingControllers --:booking
BookingControllers->client :response
BookingControllers->BookingModel ++:findByIdAndUpdate(req.params.id,\nreq.body,{new:true,\nrunValidators:true});
BookingModel->bookingDatabase ++:BookingSchema
bookingDatabase-->BookingModel --:booking
BookingModel-->BookingControllers --:booking
BookingControllers->client --:response
client->server ++:req.delete('/bookings/:id')
server->booking --++:app.use('api/v1/bookings',bookings)
booking->middleware ++:protect
middleware->jwt ++:verify(token,secret)
jwt-->middleware --: decoded
middleware->modelUser ++:findById(decoded.id)
modelUser -> userDatabase ++:find(_id:decoded.id)
userDatabase --> modelUser --:user
modelUser-->middleware --:req.user
middleware-->booking --:next
booking->BookingControllers --++:deleteBooking
BookingControllers->BookingModel ++:findByIdAndDelete(req.param.id)
BookingModel->bookingDatabase ++:BookingSchema
BookingControllers->client
@enduml