api_config.yml 7.07 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
# THIS FILE IS DYNAMICALLY USED FOR THE BACKEND AND THE FRONTEND
2
3
# TAKE CARE WHEN MODYFING IT ;)

Florent Chehab's avatar
Florent Chehab committed
4
# model : the model name (may be absent) Model can't be present more than once.
5
6
7
8
9
10
11
12
13
# viewset : the viewset name for the api
# api_end_pont : the main part of the url for making request to the api
#  This string will also be used for naming variables in JS !!
#  So no weird characters there please...
# versionned: boolean to specify wether this model is versionned or not
# api_attr : to specify some attributes that may be captured
#  and used in the viewset
# requires_testing: boolean to tell if this viewset is only availble in
#  a testing environment.
Florent Chehab's avatar
Florent Chehab committed
14
# ignore_in_admin: don't register the model in the admin
15

16
17
18
19
20
# Moderation levels are defined as follow :
#     0 : moderation will never be applied
#     1 : moderation will be on if the global settings for moderation is turned on
#     2 : (default for security reasons) moderation will always be on no matter what
# It is to be noted that staff members, dri members and moderators won't be subject to moderation !
Florent Chehab's avatar
Florent Chehab committed
21
#
Florent Chehab's avatar
Florent Chehab committed
22
23
24
# When moderation_level > 0, someone may decide to enforce moderation on for the users with a lower
#   status in the app. This is called object level moderation !
#   staff ⊂ dri ⊂ moderators ⊂ authenficated_user
25
26

# For viewset permissions we have the followings
Florent Chehab's avatar
Florent Chehab committed
27
#
28
29
# By default, every viewset will have :
#     - isAuthentificated : to use the API the client needs to be authentificated
Florent Chehab's avatar
Florent Chehab committed
30
#     - noDeleteIfNotStaff : nothing can be deleted except if you are a staff member
31
32
33
34
#
# Some viewsets may have more presice permissions
#     - IsStaff
#     - IsStaffOrReadOnly
Florent Chehab's avatar
Florent Chehab committed
35
#     - IsDriOrReadOnly
36
#     - IsOwner : (or )
Florent Chehab's avatar
Florent Chehab committed
37
#
38

Florent Chehab's avatar
Florent Chehab committed
39
40
41
42

#####################################################
## Custom Viewsets that doesn't have a model behind
#####################################################
43
44
- viewset: AppModerationStatusViewSet
  api_end_point: serverModerationStatus
45
  import_location: other_viewsets
46
47
48
  read_only: true
  is_api_view: true

Florent Chehab's avatar
Florent Chehab committed
49
50
51
52
#####################
## Standard Viewsets
#####################

53
54
- model: Country
  viewset: CountryViewSet
55
  import_location: country
Florent Chehab's avatar
Florent Chehab committed
56
  api_end_point: countries
57
  viewset_permission: IsStaffOrReadOnly
58
59
60

- model: City
  viewset: CityViewSet
61
  import_location: city
Florent Chehab's avatar
Florent Chehab committed
62
  api_end_point: cities
63
  moderation_level: 2
64
  viewset_permission: NoPostIfNotStaff
65

Florent Chehab's avatar
Florent Chehab committed
66
67
- model: University
  viewset: UniversityViewSet
68
  import_location: university
Florent Chehab's avatar
Florent Chehab committed
69
  api_end_point: universities
70
  moderation_level: 2
71
  viewset_permission: NoPostIfNotStaff
72

Florent Chehab's avatar
Florent Chehab committed
73
74
- model: Campus
  viewset: CampusViewSet
75
  import_location: campus
Florent Chehab's avatar
Florent Chehab committed
76
  api_end_point: campuses
77
  versionned: true
78
  moderation_level: 2
79
80


Florent Chehab's avatar
Florent Chehab committed
81
82
83
- model: UserData
  viewset: UserDataViewSet
  import_location: user
84
  api_end_point: userData
Florent Chehab's avatar
Florent Chehab committed
85
  api_name: user-data-detail
86
87
  moderation_level: 0
  viewset_permission: IsOwner
Florent Chehab's avatar
Florent Chehab committed
88
89
90
91
92
93


- model: Tag
  viewset: TagViewSet
  import_location: tag
  api_end_point: tags
94
95
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
96

97
98
- model: Currency
  viewset: CurrencyViewSet
99
  import_location: currency
Florent Chehab's avatar
Florent Chehab committed
100
  api_end_point: currencies
101
102
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
103
104
105

- model: Department
  viewset: DepartmentViewSet
Florent Chehab's avatar
Florent Chehab committed
106
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
107
  api_end_point: departments
108
109
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
110
111
112

- model: Specialty
  viewset: SpecialtyViewSet
Florent Chehab's avatar
Florent Chehab committed
113
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
114
  api_end_point: specialties
115
116
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
117
118
119

- model: Offer
  viewset: OfferViewSet
Florent Chehab's avatar
Florent Chehab committed
120
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
121
  api_end_point: offers
122
123
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
Florent Chehab's avatar
Florent Chehab committed
124
125
126
127


- model: CountryTaggedItem
  viewset: CountryTaggedItemViewSet
128
  import_location: country
129
130
  api_end_point: countryTaggedItems
  api_attr: (?P<country_id>[a-zA-Z]+)
Florent Chehab's avatar
Florent Chehab committed
131
  versionned: true
132
133
134

- model: CountryScholarship
  viewset: CountryScholarshipViewSet
135
  import_location: country
136
137
  api_end_point: countryScholarships
  api_attr: (?P<country_id>[a-zA-Z]+)
138
  versionned: true
139
140
141

- model: CountryDri
  viewset: CountryDriViewSet
142
  import_location: country
143
144
  api_end_point: countryDri
  api_attr: (?P<country_id>[a-zA-Z]+)
145
  enforce_moderation_user_level: 'DRI'
Florent Chehab's avatar
Florent Chehab committed
146
  viewset_permission: IsDriOrNoPost
147
  versionned: true
148
149


Florent Chehab's avatar
Florent Chehab committed
150
151
152

- model: CityTaggedItem
  viewset: CityTaggedItemViewSet
153
  import_location: city
154
155
  api_end_point: cityTaggedItems
  api_attr: (?P<city_id>[0-9]+)
156
  versionned: true
157

Florent Chehab's avatar
Florent Chehab committed
158
159
160
161


- model: UniversityTaggedItem
  viewset: UniversityTaggedItemViewSet
162
  import_location: university
163
164
  api_end_point: universityTaggedItems
  api_attr: (?P<univ_id>[0-9]+)
Florent Chehab's avatar
Florent Chehab committed
165
  versionned: true
166
167
168
169

- model: UniversityScholarship
  viewset: UniversityScholarshipViewSet
  import_location: university
170
171
  api_end_point: universityScholarships
  api_attr: (?P<univ_id>[0-9]+)
172
  versionned: true
173
174
175
176

- model: UniversityInfo
  viewset: UniversityInfoViewSet
  import_location: university
177
  viewset_permission: NoPostIfNotStaff
178
  api_end_point: universitiesInfo
179
  versionned: true
180
181
182
183

- model: UniversitySemestersDates
  viewset: UniversitySemestersDatesViewSet
  import_location: university
184
  api_end_point: universitiesSemestersDates
185
  viewset_permission: NoPostIfNotStaff
186
  versionned: true
187
188
189
190

- model: UniversityDri
  viewset: UniversityDriViewSet
  import_location: university
191
192
  api_end_point: universityDri
  api_attr: (?P<univ_id>[0-9]+)
193
  enforce_moderation_user_level: 'DRI'
Florent Chehab's avatar
Florent Chehab committed
194
  viewset_permission: IsDriOrNoPost
195
  versionned: true
196

Florent Chehab's avatar
Florent Chehab committed
197
198
199
200


- model: CampusTaggedItem
  viewset: CampusTaggedItemViewSet
201
  import_location: campus
202
203
  api_end_point: campusTaggedItems
  api_attr: (?P<campus_id>[0-9]+)
Florent Chehab's avatar
Florent Chehab committed
204
205
206
207
  versionned: true

- model: null
  viewset: MainCampusViewSet
208
  import_location: campus
209
  api_end_point: mainCampuses
Florent Chehab's avatar
Florent Chehab committed
210
211
212
213
  read_only: true



214
215
216
- model: Recommendation
  viewset: RecommendationViewSet
  import_location: user
217
  api_end_point: userRecommendations
218
  moderation_level: 0
219
220
221
222

- model: RecommendationList
  viewset: RecommendationListViewSet
  import_location: user
223
  api_end_point: userRecommendationLists
224
  moderation_level: 0
225
226
227
228

- model: PreviousDeparture
  viewset: PreviousDepartureViewSet
  import_location: user
229
  api_end_point: universitiesPreviousDepartures
230
  read_only: true
231
232
233
234

- model: PreviousDepartureFeedback
  viewset: PreviousDepartureFeedbackViewSet
  import_location: user
235
  api_end_point: universitiesPreviousDepartureFeedback
Florent Chehab's avatar
Florent Chehab committed
236

237
238
239
240


- model: PendingModeration
  viewset: PendingModerationViewSet
241
  import_location: abstract.my_model
242
  api_end_point: pendingModeration
243
244
  viewset_permission: IsStaff

245
246
247

- model: Version
  viewset: VersionViewSet
248
  import_location: abstract.my_model
249
  api_end_point: versions
250
  api_attr: (?P<content_type_id>[0-9]+)/(?P<object_pk>[0-9A-Za-z]+)
251
  api_name: versionsList
252
  viewset_permission: IsStaffOrReadOnly
253
  ignore_in_admin: true
254
255
256

- model: ForTestingModeration
  viewset: ForTestingModerationViewSet
257
  import_location: abstract.my_model
258
  api_end_point: test/moderation
259
  moderation_level: 1
260
261
262
263
  requires_testing: true

- model: ForTestingVersioning
  viewset: ForTestingVersioningViewSet
264
  import_location: abstract.my_model
265
  api_end_point: test/versioning
266
  moderation_level: 1
267
  requires_testing: true
268
  # versionned: true don't put it here, it is manually handled with @register decorator