-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from dev-launchers/main
feat(alearm246): release application collection
- Loading branch information
Showing
16 changed files
with
3,370 additions
and
1,608 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"routes": [ | ||
{ | ||
"method": "GET", | ||
"path": "/applicants", | ||
"handler": "applicant.find", | ||
"config": { | ||
"policies": [] | ||
} | ||
}, | ||
{ | ||
"method": "GET", | ||
"path": "/applicants/count", | ||
"handler": "applicant.count", | ||
"config": { | ||
"policies": [] | ||
} | ||
}, | ||
{ | ||
"method": "GET", | ||
"path": "/applicants/:id", | ||
"handler": "applicant.findOne", | ||
"config": { | ||
"policies": [] | ||
} | ||
}, | ||
{ | ||
"method": "POST", | ||
"path": "/applicants", | ||
"handler": "applicant.create", | ||
"config": { | ||
"policies": [] | ||
} | ||
}, | ||
{ | ||
"method": "PUT", | ||
"path": "/applicants/:id", | ||
"handler": "applicant.update", | ||
"config": { | ||
"policies": [] | ||
} | ||
}, | ||
{ | ||
"method": "DELETE", | ||
"path": "/applicants/:id", | ||
"handler": "applicant.delete", | ||
"config": { | ||
"policies": [] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-controllers) | ||
* to customize this controller | ||
*/ | ||
|
||
const { sanitizeEntity } = require('strapi-utils'); | ||
|
||
module.exports = { | ||
|
||
async create(ctx){ | ||
const { | ||
email, | ||
name, | ||
timestamp, | ||
age, | ||
role, | ||
zip, | ||
skills, | ||
experience, | ||
commitment, | ||
accepted, | ||
reason, | ||
project, | ||
level | ||
} = ctx.request.body; | ||
|
||
|
||
const applicantProject = await strapi.services.project.findOne({ slug: project }); | ||
|
||
const application = { | ||
email, | ||
name, | ||
timestamp, | ||
age, | ||
role, | ||
zip, | ||
skills, | ||
experience, | ||
commitment, | ||
accepted, | ||
reason, | ||
project: applicantProject.id, | ||
level | ||
}; | ||
|
||
const entity = await strapi.services.applicant.create(application); | ||
|
||
return sanitizeEntity(entity, { model: strapi.models.applicant}); | ||
} | ||
}; |
Oops, something went wrong.