This projet is the server for all websites of InsameeApp.
Server: Adonisjs, Postgresql
This project uses npm.
# install dependencies
npm i
# start un dev mode the project
npm run dev
# build the project
npm run build
# start in production mode the project
npm run startBefore to start, you must create a database called 'team' and tables in your database using
node ace migration:runThen, you can populate your database:
node ace db:seedIn order to be used this server with any of the front-end, you must create a .evn file using the .env.example template.
{
"register": "ok"
}{
"login": "ok"
}{
"logout": "ok"
}{
"verifyEmail": "ok"
}{
"resetPassword": "ok"
}{
"sendVerifyEmail": "ok"
}{
"sendResetPassword": "ok"
}{
"meta": {
"total": "number",
"per_page": "number",
"current_page": "number",
"last_page": "number",
"first_page": "number",
"first_page_url": "string",
"last_page_url": "string",
"next_page_url": "string",
"previous_page_url": "string"
},
"data": [
{
"id": "number",
"email": "string",
"is_verified": "boolean",
"is_admin": "boolean",
"is_blocked": "boolean",
"deleted_at": "string | null",
"created_at": "string",
"updated_at": "string"
}
]
}{
"id": "number",
"email": "string",
"is_verified": "boolean",
"is_admin": "boolean",
"is_blocked": "boolean",
"deleted_at": "string | null",
"created_at": "string",
"updated_at": "string"
}{
"destroy": "ok"
}{}{
"meta": {
"total": "number",
"per_page": "number",
"current_page": "number",
"last_page": "number",
"first_page": "number",
"first_page_url": "string",
"last_page_url": "string",
"next_page_url": "string",
"previous_page_url": "string"
},
"data": [
{
"user_id": "string",
"avatar_url": "string",
"last_name": "string",
"first_name": "string",
"current_role": "string",
"mee_profile": {
"short_text": "string",
"associations": [
{
"name": "string",
"image_url": "string"
}
],
"skills": [
{
"name": "string"
}
]
}
}
]
}{
"user_id": "string",
"avatar_url": "string",
"last_name": "string",
"first_name": "string",
"user": {
"email": "string"
},
"school": {
"name": "string"
},
"graduation_year": "number",
"current_role": "string",
"mee_profile": {
"text": "string",
"skills": [
{
"name": "string"
}
],
"focus_interests": [
{
"name": "string"
}
],
"associations": [
{
"name": "string",
"image_url": "string",
"school": {
"name": "string"
}
}
]
},
"tutoratProfile": {
"text": "string",
"difficulties_subjects": [
{
"name": "string"
}
],
"preferred_subjects": [
{
"name": "string"
}
]
},
"mobile": "string",
"url_facebook": "string",
"url_instagram": "string",
"url_twitter": "string"
}{
"meta": {
"total": "number",
"per_page": "number",
"current_page": "number",
"last_page": "number",
"first_page": "number",
"first_page_url": "string",
"last_page_url": "string",
"next_page_url": "string",
"previous_page_url": "string"
},
"data": [
{
"profile": {
"avatar_url": "string",
"last_name": "string",
"first_name": "string",
"current_role": "string"
},
"id": "number",
"type": "enum",
"shortText": "string",
"time": "number",
"subject": {
"name": "string"
},
"school": {
"name": "string"
}
}
]
}{
"type": "enum",
"time": "number",
"text": "string",
"profile": {
"avatar_url": "string",
"last_name": "string",
"first_name": "string",
"current_role": "string",
"user": {
"email": "string"
}
},
"school": {
"name": "string"
},
"subject": {
"name": "string"
}
}{
"registration": "string"
}{
"deregistration": "string"
}{
"mailto": "string"
}{}{
"meta": {
"total": "number",
"per_page": "number",
"current_page": "number",
"last_page": "number",
"first_page": "number",
"first_page_url": "string",
"last_page_url": "string",
"next_page_url": "string",
"previous_page_url": "string"
},
"data": [
{
"id": "number",
"name": "string",
"image_url": "string",
"school": {
"name": "string"
},
"thematic": {
"name": "string"
},
"tags": [
{
"name": "string"
}
],
"short_text": "string"
}
]
}{
"id": "number",
"name": "string",
"image_url": "string",
"school": {
"name": "string"
},
"thematic": {
"name": "string"
},
"tags": [
{
"name": "string"
}
],
"text": "string"
}{}{
"id": "number",
"name": "string"
}{}{}{
"id": "number",
"name": "string"
}{
"id": "number",
"name": "string"
}[
{
"id": "number",
"name": "string"
}
]{
"reported": "string",
"already": "boolean"
}POST /auth/register
Required fields
emailas stringpasswordas stringpassword_confirmationas string
No authentication required, returns a register object
Throw BadRequestException if user already exists
POST /auth/login
Required fields
emailas stringpasswordas stringrememberMeas boolean
No authentication required, user must be verified, returns a login object
POST /auth/logout
Authentication required, returns a logout object
POST /auth/verify/:email
No authentication required, returns a verifyEmail object
Throw BadRequestException if url can't be validate
Throw ForbiddenException if user is already verified
POST /auth/resetPassword/:email
Required fields
passwordas stringpassword_confirmationas string
No authentication required, returns a resetPassword object
Throw BadRequestException if url can't be validate
POST /auth/send/verifyEmail
Required fields
emailas string
No authentication required, returns a sendVerifyEmail object
Throw ForbiddenException if user is already verified
POST /auth/send/resetPassword
Required fields
emailas string
No authentication required, returns a sendResetPassword object
GET /api/v1/users
Authentication required, returns multiple-users
Authorization: admin
GET /api/v1/users/:id
Authentication required, returns a user
Authorization: admin
PATCH /api/v1/users/:id
Authentication required, returns a user
Body:
isVerifiedas booleanisAdminas booleanisBlockedas boolean
Authorization: admin
DELETE /api/v1/users/:id
Authentication required, returns a deleted user object
Authorization: the owner and admin
GET /api/v1/profiles/me
Query string
populateused to select the profile
Authentication required, returns a profile
GET /api/v1/profiles/me/tutorats/registrations
Authentication required, returns a cards-multiple-tutorats
GET /api/v1/profiles
Query string
limitas stringpageas stringpopulateas string, used to select the profile
Authentication required, returns multiple-profiles
GET /api/v1/profiles/:id
Query string
populateas string, used to select the profilecurrentRoleas string, filterskillas number, filterfocusInterestas number, filterassociationas number, filterpreferredSubjectas number, filterdifficultiesSubjectas number, filter
Authentication required, returns a profile
GET /api/v1/profiles/:id/tutorats
Query string
limitas stringpageas stringtype, as string, filter
Authentication required, returns multiple tutorats
PATCH /api/v1/profiles/:id
Authentication required, returns a profile
Authorization: only the owner
Query string
populateas string, used to select the profile
Optional fields
lastNameas stringfirstNameas stringcurrentRoleas stringmobileas stringgraduationYearas numbermobileas stringurlFacebookas stringurlInstagramas stringurlTwitteras string
?populate=mee
Optional fields
textas stringskillsas array of numbersfocusInterestsas array of numbersassociationsas array of numbers
?populate=tutorat
Optional fields
textas stringpreferredSubjectsas array of numbersdifficultiesSubjectsas array of numbers
PATCH /api/v1/profiles/:id/picture
Optional field
pictureas file
Authentication required, returns a profile
Authorization: only the owner or an admin
GET /api/v1/tutorats
Authentication required, returns a tutorat
Query string
limitas stringpageas stringcurrentRoleas string, filter (=)subjectas number, filter (=)schoolas number, filter (=)timeas number, filter (<)typeas number, filter (=)
GET /api/v1/tutorats/:id
Authentication required, returns multiple tutorats
POST /api/v1/tutorats
Required fields
subject, as numberschool, as numbertype, as string
Optional fields
time, as number, required when type is 'offer'text, string
Authentication required, returns a tutorat
PATCH /api/v1/tutorats/:id
Optional fields
time, as numbertext, string
Authentication required, returns a tutorat
Authorization: only the owner
DELETE /api/v1/tutorats/:id
Authentication required, returns deleted tutorat object
Authorization: only the owner
POST /api/v1/tutorats/:id/reports
Body
reasonas numberdescriptionas string
Authentication required, returns a report
GET /api/v1/tutorats/:id/registrations
Authentication required, returns a Cards Multiple Profiles
POST /api/v1/tutorats/:id/registrations
Authentication required, returns a registration object
DELETE /api/v1/tutorats/:id/registrations
Authentication required, returns a deregistration object
GET /api/v1/tutorats/:id/registrations/contacts
Authentication required, returns a contact object
GET /api/v1/associations
Query string
serialize, as enum (card)page, as stringname, as stringthematics[], as array of numbertags[], as array of numberschools[], as array of number
Authentication required, returns multiple associations
GET /api/v1/associations/:id
Query string
platform, as enum
Authentication required, returns an association
POST /api/v1/associations
Body
nameas stringtextas stringemailas stringschoolIdas numberthematicIdas numbertagsas array of number
Authentication required, returns an association
Authorization: admin
PATCH /api/v1/associations/:id
Body
nameas stringtextas stringemailas stringschoolIdas numbertagsas array of number
Authentication required, returns an association
Authorization: admin
PATCH /api/v1/associations/:id/picture
Optional field
pictureas file
Authentication required, returns a profile
Authorization: admin
DELETE /api/v1/associations/:id
Authentication required, returns an association
Authorization: admin
PATCH /api/v1/association/:id/restore
Authentication required, returns an association
Authorization: admin
GET /api/v1/associations/:id/profiles
Query string
limit, as stringpage, as string
Authentication required, returns a multiple profiles
POST /api/v1/associations/:id/reports
Body
reasonas numberdescriptionas string
Authentication required, returns a report
GET /api/v1/reports/profiles
Query string
page, as string
Authentication required, returns multiple-profiles-reports
Authorization: admin
GET /api/v1/reports/profiles/:id
Authentication required, returns reports
GET /api/v1/reports/:id/profiles
Authentication required, returns a profile-report
Authorization: admin
DELETE /api/v1/reports/:id/profiles
Authentication required, returns a profile-report
Authorization: admin
GET /api/v1/reports/tutorats
Query string
page, as string
Authentication required, returns multiple-tutorats-reports
Authorization: admin
GET /api/v1/reports/tutorats/:id
Authentication required, returns reports
GET /api/v1/reports/:id/tutorats
Authentication required, returns a tutorat-report
Authorization: admin
DELETE /api/v1/reports/:id/tutorats
Authentication required, returns a tutorat-report
Authorization: admin
GET /api/v1/reports/associations
Query string
page, as string
Authentication required, returns multiple-associations-reports
Authorization: admin
GET /api/v1/reports/associations/:id
Authentication required, returns reports
GET /api/v1/reports/:id/associations
Authentication required, returns a association-report
Authorization: admin
DELETE /api/v1/reports/:id/associations
Authentication required, returns a association-report
Authorization: admin
GET /api/v1/schools
Query string
platformas enum
Authentication required, returns multiple schools
POST /api/v1/schools
Body
nameas stringhostas string
Authentication required, returns a school Authorization: admin
PATCH /api/v1/schools/:id
Body
nameas stringhostas string
Authentication required, returns a school Authorization: admin
DELETE /api/v1/schools/:id
Authentication required, returns a school Authorization: admin
PATCH /api/v1/schools/:id/restore
Authentication required, returns a school Authorization: admin
GET /api/v1/skills
Authentication required, returns multiple skills
POST /api/v1/skills
Body
nameas string
Authentication required, returns a skill Authorization: admin
PATCH /api/v1/skills/:id
Body
nameas stringhostas string
Authentication required, returns a skill Authorization: admin
DELETE /api/v1/skills/:id
Authentication required, returns a skill Authorization: admin
PATCH /api/v1/skills/:id/restore
Authentication required, returns a skill Authorization: admin
GET /api/v1/focus_interests
Authentication required, returns multiple focus of interests
POST /api/v1/focus_interests
Body
nameas string
Authentication required, returns a focus_interest Authorization: admin
PATCH /api/v1/focus_interests/:id
Body
nameas stringhostas string
Authentication required, returns a focus_interest Authorization: admin
DELETE /api/v1/focus_interests/:id
Authentication required, returns a focus_interest Authorization: admin
PATCH /api/v1/focus_interests/:id/restore
Authentication required, returns a focus_interest Authorization: admin
GET /api/v1/subjects
Authentication required, returns multiple subjects
POST /api/v1/subjects
Body
nameas string
Authentication required, returns a Subject Authorization: admin
PATCH /api/v1/subjects/:id
Body
nameas stringhostas string
Authentication required, returns a Subject Authorization: admin
DELETE /api/v1/subjects/:id
Authentication required, returns a Subject Authorization: admin
PATCH /api/v1/subjects/:id/restore
Authentication required, returns a Subject Authorization: admin
GET /api/v1/thematics
Authentication required, returns multiple thematics
POST /api/v1/thematics
Body
nameas string
Authentication required, returns a thematic Authorization: admin
PATCH /api/v1/thematics/:id
Body
nameas stringhostas string
Authentication required, returns a thematic Authorization: admin
DELETE /api/v1/thematics/:id
Authentication required, returns a thematic Authorization: admin
PATCH /api/v1/thematics/:id/restore
Authentication required, returns a thematic Authorization: admin
GET /api/v1/tags
Authentication required, returns multiple tags
POST /api/v1/tags
Body
nameas string
Authentication required, returns a tag Authorization: admin
PATCH /api/v1/tags/:id
Body
nameas stringhostas string
Authentication required, returns a tag Authorization: admin
DELETE /api/v1/tags/:id
Authentication required, returns a tag Authorization: admin
PATCH /api/v1/tags/:id/restore
Authentication required, returns a tag Authorization: admin
GET /api/v1/reasons
Query string
platformas string
Authentication required, returns multiple reasons
To authenticate a user, you must send a request to /auth/login endpoint. Then, you can send a request to /api/v1/profiles/me to get the profile from the user.
When login, you can use the remember me option to authenticate user for a long time.
When user refresh the page or come to the site, you must try to get his profile. If it's ok, the user is authenticated, if it's not, the user is not authenticated