Skip to content

Commit

Permalink
Merge pull request #169 from dev-launchers/main
Browse files Browse the repository at this point in the history
feat(alearm246): release application collection
  • Loading branch information
alearm246 authored Oct 15, 2021
2 parents e55dd44 + 66cfa80 commit ab4e725
Show file tree
Hide file tree
Showing 16 changed files with 3,370 additions and 1,608 deletions.
52 changes: 52 additions & 0 deletions api/applicant/config/routes.json
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": []
}
}
]
}
52 changes: 52 additions & 0 deletions api/applicant/controllers/applicant.js
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});
}
};
Loading

0 comments on commit ab4e725

Please sign in to comment.