-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroute_descs.txt
More file actions
125 lines (116 loc) · 10.1 KB
/
route_descs.txt
File metadata and controls
125 lines (116 loc) · 10.1 KB
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
116
117
118
119
120
121
122
123
124
125
GENERAL NOTES:
Responses will never include userIds, but tripIds are exposed (client needs them to request trip specific data).
Trip status progresses as follows: Staging -> Open -> Pre-Trip -> Post-Trip -> Complete. Once a trip has changed status, it cannot revert back.
EXPRESS ROUTES: METHOD: AUTH REQUIRED: BODY: RESPONSE BEHAVIOR:
/ OR <undefined_route> GET None N/A Sends back server welcome message
/trips GET None N/A Sends back all trip data (except planningChecklist) for all trips
with a status of Open
/leaders GET Any Role N/A Sends back a list of all the names and emails of users who are
leaders/admin
/user/profile GET Any Role N/A Sends back all user data (except lotteryWeight) for user
and all signup data for all associated trip signups
/trip/<tripId> GET None* N/A If user not logged in or not signed up for trip: sends back all trip
data for tripId (except planningChecklist) if trip is Open. If user
is signed up with tripRole Participant, sends back same trip data plus
all associated signup data. If user is signed up with tripRole Leader,
executes same behavior but includes planningChecklist, a list of other
leader's names and emails, and a list of selected participants' signups
(if trip status is Pre-Trip or later).
/trip/<tripId>/is-signed-up GET None* N/A Sends back a boolean expressing whether or not a user has a signup instance
for the trip with the specified id. Will return true for leaders leading the
trip and even for participants who signed up, but weren't selected (as long as
they still have a signup instance)
/auth/ GET None Auth code If sent with auth code, exchanges it for an auth token and sends token
to client, setting up a user account for the user
/user/add-phone POST Any Role Phone Json Stores phone number for user, overriding any previous entry and deleting
all non-numeric characters before inserting
/leader/create-trip POST Leader+ Creation form Creates a private trip using the data contained within the creation form
and redirects to /trip/<tripId> with the new tripId
/trip/<tripId>/lead/task POST Trip Leader Task json Modifies planningChecklist for trip at <tripId> accordingly. If all tasks
are marked complete, sets trip status to Complete.
/trip/<tripId>/lead/alter POST Trip Leader Alter json Modifies the data associated with the trip at <tripId> accordingly. Only
plannedDate may be editted once trip is in Pre-Trip state (and nothing may
be editted after that). class/priceOverride may not be editted once Open
status is reached.
/trip/<tripId>/lead/open POST Trip Leader N/A Sets trip status to Open, assuming its current status is Staging. May not
be performed if blurb or setenceDesc is still null (not completed).
/trip/<tripId>/lead/lottery POST Trip Leader N/A Selects up to the max_size of the trip at <tripId> participants who have
signed up for the trip. Updates the status of all signed up participants
accordingly, updating lottery weights as well. Sets status to Pre-Trip
for the trip. Sends back a list of emails of accepted participants, one
of waitlisted participants, and a list of emails of rejected participants.
May only be performed if trip status is currently Open.
/trip/<tripId>/lead/participants GET Trip Leader N/A Returns a list of all participants on a trip, regardless of their current status.
/trip/<tripId>/lead/add-participant POST Trip Leader N/A Adds a participant from the waitlist to the list of selected participants,
prioritizing confirmed participants. Will return a JSON object with a single
field "success" which will be set to 0 if there are no participants on the
waitlist left and 1 otherwise. May only be performed if trip status is
currently Pre-Trip.
/trip/<tripId>/lead/remove-participant POST Trip Leader Remove json Removes the participant specified by email from the trip (takes their Selected
status and turns it into Not Selected). Can only be performed if the trip status
is currently Pre-Trip and the specified email matches a selected participant.
/trip/<tripId>/lead/attendance POST Trip Leader Attendance json Updates status of attendant participants and noshows, updating lottery weight
accordingly. Deletes sign up instances of excused absent. Sets status to Post-Trip.
May only be performed if trip status is currently Pre-Trip and current datetime is
past the trip's plannedDate
/trip/<tripId>/signup POST Any Role Sign up form Creates a new TripSignUp instance for the user on the trip at <tripId>, if
the trip has Open status
/trip/<tripId>/participate/confirm POST Any Role N/A Changes signup status of user to confirmed for trip at tripId. Assumes
any required payment has been made (although there is no way to enforce
this on this server)
/admin/alter-user POST Admin Role json Updates role of target user accordingly. If a leader/admin is demoted, all trip
signups in which they had the role of trip leader are deleted.
TODO: /trip/<tripId>/lead/cancel
TODO: /trip/<tripId>/lead/quit
TODO: /trip/<tripId>/cancel
FORM/JSON DESCRIPTIONS:
Phone Json:
{
phoneNum: <phone_num> //No need to sanitize - all non-numeric characters are filtered out automatically
}
Creation Json:
{
leaders: [<leader_email1>, ...], //Not necessarily including the email of the creating leader, whose role is implicit
tripName: <trip_name>,
plannedDate: <date_obj>, //Specific up to the day of the trip (but not necessarily the hour)
maxSize: <max_num_participants>,
class: <price_class>, //Options include characters A-J (see marketplace) plus Z (for free trips)
priceOverride: <price_float>, //Only class or price_override should be defined (but one has to be)
sentenceDesc: <sentence_long_description>, //Can be null
blurb: <paragraph_long_description>, //Can be null
}
Task Json:
{
task: <name_of_task>,
responsible: <email_of_leader>, //May NOT be null - empty string if no one is responsible yet
complete: <boolean>,
}
Remove Json:
{
email: <participant_email>,
}
Alter Json:
{
<any_trip_creation_field>, //Except leaders
//Multiple fields may be added, but they aren't all required (unlike with creation)
}
Attendance Json:
{
selectedParticipants: {
<participant_email>: <attendance_status>, //attendance_status can be any of 'Attended', 'Excused Absence', or 'No Show'
...
},
additionalParticipants: [
<participant_email>,
...
]
}
Signup Json:
{
tripId: <trip_id>,
}
Role Json:
{
role: <web_role>, //May be any of Participant, Leader, or Admin
email: <email_of_user_to_alter>,
}