api_config.yml 6.59 KB
Newer Older
1 2 3 4
# THIS FILE IS USED TO GENERATE OTHER VERY IMPORTANT FILES
# BOTH IN THE FRONTEND AND IN THE BACKEND !
# TAKE CARE WHEN MODYFING IT ;)

5
# model : the model name (may be null) Model can't be present more than once.
6 7 8 9 10 11 12 13 14 15
# 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.

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 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 27 28 29 30 31 32 33 34 35 36 37

# For viewset permissions we have the followings
# 
# By default, every viewset will have :
#     - isAuthentificated : to use the API the client needs to be authentificated
#     - noDeleteIsNotStaff : nothing can be deleted except if you are a staff member
#
# Some viewsets may have more presice permissions
#     - IsStaff
#     - IsStaffOrReadOnly
#     - IsDriOrReadOnly   
#     - IsOwner : (or )
# 
38

39 40
- model: Country
  viewset: CountryViewSet
41
  import_location: country
Florent Chehab's avatar
Florent Chehab committed
42
  api_end_point: countries
43
  viewset_permission: IsStaffOrReadOnly
44 45 46

- model: City
  viewset: CityViewSet
47
  import_location: city
Florent Chehab's avatar
Florent Chehab committed
48
  api_end_point: cities
49
  moderation_level: 2
50

Florent Chehab's avatar
Florent Chehab committed
51 52
- model: University
  viewset: UniversityViewSet
53
  import_location: university
Florent Chehab's avatar
Florent Chehab committed
54
  api_end_point: universities
55
  moderation_level: 2
56

Florent Chehab's avatar
Florent Chehab committed
57 58
- model: Campus
  viewset: CampusViewSet
59
  import_location: campus
Florent Chehab's avatar
Florent Chehab committed
60
  api_end_point: campuses
61
  versionned: true
62
  moderation_level: 2
63 64


Florent Chehab's avatar
Florent Chehab committed
65 66 67
- model: UserData
  viewset: UserDataViewSet
  import_location: user
68
  api_end_point: userData
Florent Chehab's avatar
Florent Chehab committed
69
  api_name: user-data-detail
70 71
  moderation_level: 0
  viewset_permission: IsOwner
Florent Chehab's avatar
Florent Chehab committed
72 73 74 75 76 77


- model: Tag
  viewset: TagViewSet
  import_location: tag
  api_end_point: tags
78 79
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
80

81 82
- model: Currency
  viewset: CurrencyViewSet
83
  import_location: currency
Florent Chehab's avatar
Florent Chehab committed
84
  api_end_point: currencies
85 86
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
87 88 89

- model: Department
  viewset: DepartmentViewSet
Florent Chehab's avatar
Florent Chehab committed
90
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
91
  api_end_point: departments
92 93
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
94 95 96

- model: Specialty
  viewset: SpecialtyViewSet
Florent Chehab's avatar
Florent Chehab committed
97
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
98
  api_end_point: specialties
99 100
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
101 102 103

- model: Semester
  viewset: SemesterViewSet
Florent Chehab's avatar
Florent Chehab committed
104
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
105
  api_end_point: semesters
106 107
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
108 109 110

- model: Offer
  viewset: OfferViewSet
Florent Chehab's avatar
Florent Chehab committed
111
  import_location: other_core
Florent Chehab's avatar
Florent Chehab committed
112
  api_end_point: offers
113 114
  moderation_level: 2
  viewset_permission: IsStaffOrReadOnly
Florent Chehab's avatar
Florent Chehab committed
115 116 117 118


- model: CountryTaggedItem
  viewset: CountryTaggedItemViewSet
119
  import_location: country
120 121
  api_end_point: countryTaggedItems
  api_attr: (?P<country_id>[a-zA-Z]+)
Florent Chehab's avatar
Florent Chehab committed
122
  versionned: true
123 124 125

- model: CountryScholarship
  viewset: CountryScholarshipViewSet
126
  import_location: country
127 128
  api_end_point: countryScholarships
  api_attr: (?P<country_id>[a-zA-Z]+)
129
  versionned: true
130 131 132

- model: CountryDri
  viewset: CountryDriViewSet
133
  import_location: country
134 135
  api_end_point: countryDri
  api_attr: (?P<country_id>[a-zA-Z]+)
136
  enforce_moderation_user_level: 'DRI'
137
  versionned: true
138 139


Florent Chehab's avatar
Florent Chehab committed
140 141 142

- model: CityTaggedItem
  viewset: CityTaggedItemViewSet
143
  import_location: city
144 145
  api_end_point: cityTaggedItems
  api_attr: (?P<city_id>[0-9]+)
146
  versionned: true
147

Florent Chehab's avatar
Florent Chehab committed
148 149 150 151


- model: UniversityTaggedItem
  viewset: UniversityTaggedItemViewSet
152
  import_location: university
153 154
  api_end_point: universityTaggedItems
  api_attr: (?P<univ_id>[0-9]+)
Florent Chehab's avatar
Florent Chehab committed
155
  versionned: true
156 157 158 159

- model: UniversityScholarship
  viewset: UniversityScholarshipViewSet
  import_location: university
160 161
  api_end_point: universityScholarships
  api_attr: (?P<univ_id>[0-9]+)
162
  versionned: true
163 164 165 166

- model: UniversityInfo
  viewset: UniversityInfoViewSet
  import_location: university
167
  api_end_point: universitiesInfo
168
  versionned: true
169 170 171 172

- model: UniversitySemestersDates
  viewset: UniversitySemestersDatesViewSet
  import_location: university
173
  api_end_point: universitiesSemestersDates
174
  versionned: true
175 176 177 178

- model: UniversityDri
  viewset: UniversityDriViewSet
  import_location: university
179 180
  api_end_point: universityDri
  api_attr: (?P<univ_id>[0-9]+)
181
  enforce_moderation_user_level: 'DRI'
182
  versionned: true
183

Florent Chehab's avatar
Florent Chehab committed
184 185 186 187


- model: CampusTaggedItem
  viewset: CampusTaggedItemViewSet
188
  import_location: campus
189 190
  api_end_point: campusTaggedItems
  api_attr: (?P<campus_id>[0-9]+)
Florent Chehab's avatar
Florent Chehab committed
191 192 193 194
  versionned: true

- model: null
  viewset: MainCampusViewSet
195
  import_location: campus
196
  api_end_point: mainCampuses
Florent Chehab's avatar
Florent Chehab committed
197 198 199 200
  read_only: true



201 202 203
- model: Recommendation
  viewset: RecommendationViewSet
  import_location: user
204
  api_end_point: userRecommendations
205
  moderation_level: 0
206 207 208 209

- model: RecommendationList
  viewset: RecommendationListViewSet
  import_location: user
210
  api_end_point: userRecommendationLists
211
  moderation_level: 0
212 213 214 215

- model: PreviousDeparture
  viewset: PreviousDepartureViewSet
  import_location: user
216
  api_end_point: universitiesPreviousDepartures
217
  read_only: true
218 219 220 221

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

224 225 226 227


- model: PendingModeration
  viewset: PendingModerationViewSet
228
  import_location: abstract.my_model
229
  api_end_point: pendingModeration
230 231
  viewset_permission: IsStaff

232 233 234

- model: Version
  viewset: VersionViewSet
235
  import_location: abstract.my_model
236
  api_end_point: versions
237
  api_attr: (?P<content_type_id>[0-9]+)/(?P<object_pk>[0-9A-Za-z]+)
238
  api_name: versionsList
239
  ignore_in_admin: true
240 241 242

- model: ForTestingModeration
  viewset: ForTestingModerationViewSet
243
  import_location: abstract.my_model
244
  api_end_point: test/moderation
245
  moderation_level: 1
246 247 248 249
  requires_testing: true

- model: ForTestingVersioning
  viewset: ForTestingVersioningViewSet
250
  import_location: abstract.my_model
251
  api_end_point: test/versioning
252
  moderation_level: 1
253
  requires_testing: true
254
  # versionned: true don't put it here, it is manually handled with @register decorator