Update API docs

This commit is contained in:
xfarrow
2025-06-10 12:20:34 +02:00
parent ade6a05408
commit 443b9d826b
34 changed files with 84 additions and 43 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/backend/apis/nodejs/node_modules
/backend/apis/nodejs/node_modules/.bin
/backend/apis/nodejs/node_modules/.bin
/backend/apis/nodejs/node_modules

View File

@ -1,7 +1,7 @@
meta { meta {
name: ChangeApplicationStatus name: ChangeApplicationStatus
type: http type: http
seq: 8 seq: 4
} }
patch { patch {

View File

@ -1,7 +1,7 @@
meta { meta {
name: CreateApplication name: CreateApplication
type: http type: http
seq: 11 seq: 1
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: DeleteApplication name: DeleteApplication
type: http type: http
seq: 10 seq: 2
} }
delete { delete {

View File

@ -1,7 +1,7 @@
meta { meta {
name: GetApplicantsByJobOffer name: GetApplicantsByJobOffer
type: http type: http
seq: 3 seq: 5
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: GetApplicantsByOrganization name: GetApplicantsByOrganization
type: http type: http
seq: 4 seq: 6
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: GetMyApplications name: GetMyApplications
type: http type: http
seq: 9 seq: 3
} }
get { get {

View File

@ -1,11 +0,0 @@
meta {
name: CreateExperience
type: http
seq: 1
}
post {
url: http://localhost:3000/api/experiences
body: none
auth: inherit
}

View File

@ -0,0 +1,21 @@
meta {
name: CreateExperience
type: http
seq: 1
}
post {
url: http://localhost:3000/api/experiences
body: json
auth: inherit
}
body:json {
{
"title" : "Software engineer",
"description" : "I worked as a software engineer in this company.",
"organizationName" : "Blink Inc.",
"type" : "WORK",
"date": "[2022-01-01,2023-01-01)"
}
}

View File

@ -0,0 +1,11 @@
meta {
name: GetExperience
type: http
seq: 2
}
get {
url: http://localhost:3000/api/experiences/1
body: none
auth: none
}

View File

@ -1,7 +1,7 @@
meta { meta {
name: CreateJobOffer name: CreateJobOffer
type: http type: http
seq: 7 seq: 1
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: DeleteJobOffer name: DeleteJobOffer
type: http type: http
seq: 6 seq: 2
} }
delete { delete {

View File

@ -1,7 +1,7 @@
meta { meta {
name: GetJobOffers name: GetJobOffers
type: http type: http
seq: 5 seq: 3
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: CreateOrganization name: CreateOrganization
type: http type: http
seq: 17 seq: 1
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: DeleteOrganization name: DeleteOrganization
type: http type: http
seq: 14 seq: 4
} }
delete { delete {

View File

@ -1,7 +1,7 @@
meta { meta {
name: FilterOrganizationByPrefix name: FilterOrganizationByPrefix
type: http type: http
seq: 2 seq: 5
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: GetOrganization name: GetOrganization
type: http type: http
seq: 16 seq: 2
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: UpdateOrganization name: UpdateOrganization
type: http type: http
seq: 15 seq: 3
} }
patch { patch {

View File

@ -1,7 +1,7 @@
meta { meta {
name: AddOrganizationAdmin name: AddOrganizationAdmin
type: http type: http
seq: 13 seq: 1
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: RemoveOrganizationAdmin name: RemoveOrganizationAdmin
type: http type: http
seq: 12 seq: 2
} }
delete { delete {

View File

@ -1,7 +1,7 @@
meta { meta {
name: ActivatePerson name: ActivatePerson
type: http type: http
seq: 27 seq: 3
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: DeleteContactInfo name: DeleteContactInfo
type: http type: http
seq: 19 seq: 11
} }
delete { delete {

View File

@ -1,7 +1,7 @@
meta { meta {
name: DeletePerson name: DeletePerson
type: http type: http
seq: 21 seq: 9
} }
delete { delete {

View File

@ -1,7 +1,7 @@
meta { meta {
name: GetContactInfosByPerson name: GetContactInfosByPerson
type: http type: http
seq: 18 seq: 12
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: GetMyself name: GetMyself
type: http type: http
seq: 22 seq: 8
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: GetPerson name: GetPerson
type: http type: http
seq: 23 seq: 7
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: InsertContactInfo name: InsertContactInfo
type: http type: http
seq: 20 seq: 10
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: Login name: Login
type: http type: http
seq: 28 seq: 2
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: Register name: Register
type: http type: http
seq: 29 seq: 1
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: RequestNewPassword name: RequestNewPassword
type: http type: http
seq: 25 seq: 5
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: ResetNewPassword name: ResetNewPassword
type: http type: http
seq: 24 seq: 6
} }
post { post {

View File

@ -1,7 +1,7 @@
meta { meta {
name: UpdatePerson name: UpdatePerson
type: http type: http
seq: 26 seq: 4
} }
patch { patch {

View File

@ -3,5 +3,5 @@ auth {
} }
auth:bearer { auth:bearer {
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjEsImlhdCI6MTc0NDk2OTAxNCwiZXhwIjoxNzQ0OTk3ODE0fQ.eAzcwzTPnNnqmmX9TCUroFLiJxQlQ49fGMVs1bXxXQM token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjEsImlhdCI6MTc0OTU1MDM1OCwiZXhwIjoxNzQ5NTc5MTU4fQ.2oZk-agnonMEZw3cdf8bKjerTGpjLdxoglCiqfLVbyc
} }

View File

@ -15,7 +15,7 @@ const Experience = require('../models/experience_model');
const express = require('express'); const express = require('express');
const jwtUtils = require('../utils/jwt_utils'); const jwtUtils = require('../utils/jwt_utils');
async function addExperience(req, res) { async function insert(req, res) {
try { try {
const experienceToInsert = Experience.createExperience( const experienceToInsert = Experience.createExperience(
req.body.title, req.body.title,
@ -29,15 +29,31 @@ async function addExperience(req, res) {
const insertedExperience = await Experience.insert(experienceToInsert); const insertedExperience = await Experience.insert(experienceToInsert);
return res.status(201).json(insertedExperience); return res.status(201).json(insertedExperience);
} catch (error) { } catch (error) {
console.error(`Error in function ${addExperience.name}: ${error}`); console.error(`Error in function ${insert.name}: ${error}`);
return res.status(500).json({ return res.status(500).json({
error: 'Internal server error' error: 'Internal server error'
}); });
} }
} }
async function find(req, res) {
try {
const experience = await Experience.find(req.params.experienceId);
if (experience == null) {
return res.status(404).send();
}
return res.status(200).json(jobApplication);
} catch (error) {
console.error(`Error in function ${find.name}: ${error}`);
res.status(500).json({
error: 'Internal server error'
});
}
}
const routes = express.Router(); const routes = express.Router();
routes.post('/', jwtUtils.extractToken, addExperience); routes.post('/', jwtUtils.extractToken, insert);
routes.get('/:experienceId', jwtUtils.extractToken, find);
module.exports = { module.exports = {
routes routes