api_config.yml 7.23 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: Semester
  viewset: SemesterViewSet
Florent Chehab's avatar
Florent Chehab committed
120
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
121
  api_end_point: semesters
122 123
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
124 125 126

- model: Offer
  viewset: OfferViewSet
Florent Chehab's avatar
Florent Chehab committed
127
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
128
  api_end_point: offers
129 130
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
Florent Chehab's avatar
Florent Chehab committed
131 132 133 134


- model: CountryTaggedItem
  viewset: CountryTaggedItemViewSet
135
  import_location: country
136 137
  api_end_point: countryTaggedItems
  api_attr: (?P<country_id>[a-zA-Z]+)
Florent Chehab's avatar
Florent Chehab committed
138
  versionned: true
139 140 141

- model: CountryScholarship
  viewset: CountryScholarshipViewSet
142
  import_location: country
143 144
  api_end_point: countryScholarships
  api_attr: (?P<country_id>[a-zA-Z]+)
145
  versionned: true
146 147 148

- model: CountryDri
  viewset: CountryDriViewSet
149
  import_location: country
150 151
  api_end_point: countryDri
  api_attr: (?P<country_id>[a-zA-Z]+)
152
  enforce_moderation_user_level: 'DRI'
Florent Chehab's avatar
Florent Chehab committed
153
  viewset_permission: IsDriOrNoPost
154
  versionned: true
155 156


Florent Chehab's avatar
Florent Chehab committed
157 158 159

- model: CityTaggedItem
  viewset: CityTaggedItemViewSet
160
  import_location: city
161 162
  api_end_point: cityTaggedItems
  api_attr: (?P<city_id>[0-9]+)
163
  versionned: true
164

Florent Chehab's avatar
Florent Chehab committed
165 166 167 168


- model: UniversityTaggedItem
  viewset: UniversityTaggedItemViewSet
169
  import_location: university
170 171
  api_end_point: universityTaggedItems
  api_attr: (?P<univ_id>[0-9]+)
Florent Chehab's avatar
Florent Chehab committed
172
  versionned: true
173 174 175 176

- model: UniversityScholarship
  viewset: UniversityScholarshipViewSet
  import_location: university
177 178
  api_end_point: universityScholarships
  api_attr: (?P<univ_id>[0-9]+)
179
  versionned: true
180 181 182 183

- model: UniversityInfo
  viewset: UniversityInfoViewSet
  import_location: university
184
  viewset_permission: NoPostIfNotStaff
185
  api_end_point: universitiesInfo
186
  versionned: true
187 188 189 190

- model: UniversitySemestersDates
  viewset: UniversitySemestersDatesViewSet
  import_location: university
191
  api_end_point: universitiesSemestersDates
192
  viewset_permission: NoPostIfNotStaff
193
  versionned: true
194 195 196 197

- model: UniversityDri
  viewset: UniversityDriViewSet
  import_location: university
198 199
  api_end_point: universityDri
  api_attr: (?P<univ_id>[0-9]+)
200
  enforce_moderation_user_level: 'DRI'
Florent Chehab's avatar
Florent Chehab committed
201
  viewset_permission: IsDriOrNoPost
202
  versionned: true
203

Florent Chehab's avatar
Florent Chehab committed
204 205 206 207


- model: CampusTaggedItem
  viewset: CampusTaggedItemViewSet
208
  import_location: campus
209 210
  api_end_point: campusTaggedItems
  api_attr: (?P<campus_id>[0-9]+)
Florent Chehab's avatar
Florent Chehab committed
211 212 213 214
  versionned: true

- model: null
  viewset: MainCampusViewSet
215
  import_location: campus
216
  api_end_point: mainCampuses
Florent Chehab's avatar
Florent Chehab committed
217 218 219 220
  read_only: true



221 222 223
- model: Recommendation
  viewset: RecommendationViewSet
  import_location: user
224
  api_end_point: userRecommendations
225
  moderation_level: 0
226 227 228 229

- model: RecommendationList
  viewset: RecommendationListViewSet
  import_location: user
230
  api_end_point: userRecommendationLists
231
  moderation_level: 0
232 233 234 235

- model: PreviousDeparture
  viewset: PreviousDepartureViewSet
  import_location: user
236
  api_end_point: universitiesPreviousDepartures
237
  read_only: true
238 239 240 241

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

244 245 246 247


- model: PendingModeration
  viewset: PendingModerationViewSet
248
  import_location: abstract.my_model
249
  api_end_point: pendingModeration
250 251
  viewset_permission: IsStaff

252 253 254

- model: Version
  viewset: VersionViewSet
255
  import_location: abstract.my_model
256
  api_end_point: versions
257
  api_attr: (?P<content_type_id>[0-9]+)/(?P<object_pk>[0-9A-Za-z]+)
258
  api_name: versionsList
259
  viewset_permission: IsStaffOrReadOnly
260
  ignore_in_admin: true
261 262 263

- model: ForTestingModeration
  viewset: ForTestingModerationViewSet
264
  import_location: abstract.my_model
265
  api_end_point: test/moderation
266
  moderation_level: 1
267 268 269 270
  requires_testing: true

- model: ForTestingVersioning
  viewset: ForTestingVersioningViewSet
271
  import_location: abstract.my_model
272
  api_end_point: test/versioning
273
  moderation_level: 1
274
  requires_testing: true
275
  # versionned: true don't put it here, it is manually handled with @register decorator