mirror of
https://github.com/xfarrow/blink
synced 2025-06-27 09:03:02 +02:00
Update API docs
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal 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
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: ChangeApplicationStatus
|
||||
type: http
|
||||
seq: 8
|
||||
seq: 4
|
||||
}
|
||||
|
||||
patch {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: CreateApplication
|
||||
type: http
|
||||
seq: 11
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: DeleteApplication
|
||||
type: http
|
||||
seq: 10
|
||||
seq: 2
|
||||
}
|
||||
|
||||
delete {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: GetApplicantsByJobOffer
|
||||
type: http
|
||||
seq: 3
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: GetApplicantsByOrganization
|
||||
type: http
|
||||
seq: 4
|
||||
seq: 6
|
||||
}
|
||||
|
||||
get {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: GetMyApplications
|
||||
type: http
|
||||
seq: 9
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
@ -1,11 +0,0 @@
|
||||
meta {
|
||||
name: CreateExperience
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:3000/api/experiences
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
@ -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)"
|
||||
}
|
||||
}
|
11
backend/apis/BlinkApiCollection/Experience/GetExperience.bru
Normal file
11
backend/apis/BlinkApiCollection/Experience/GetExperience.bru
Normal file
@ -0,0 +1,11 @@
|
||||
meta {
|
||||
name: GetExperience
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: http://localhost:3000/api/experiences/1
|
||||
body: none
|
||||
auth: none
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: CreateJobOffer
|
||||
type: http
|
||||
seq: 7
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: DeleteJobOffer
|
||||
type: http
|
||||
seq: 6
|
||||
seq: 2
|
||||
}
|
||||
|
||||
delete {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: GetJobOffers
|
||||
type: http
|
||||
seq: 5
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: CreateOrganization
|
||||
type: http
|
||||
seq: 17
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: DeleteOrganization
|
||||
type: http
|
||||
seq: 14
|
||||
seq: 4
|
||||
}
|
||||
|
||||
delete {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: FilterOrganizationByPrefix
|
||||
type: http
|
||||
seq: 2
|
||||
seq: 5
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: GetOrganization
|
||||
type: http
|
||||
seq: 16
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: UpdateOrganization
|
||||
type: http
|
||||
seq: 15
|
||||
seq: 3
|
||||
}
|
||||
|
||||
patch {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: AddOrganizationAdmin
|
||||
type: http
|
||||
seq: 13
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: RemoveOrganizationAdmin
|
||||
type: http
|
||||
seq: 12
|
||||
seq: 2
|
||||
}
|
||||
|
||||
delete {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: ActivatePerson
|
||||
type: http
|
||||
seq: 27
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: DeleteContactInfo
|
||||
type: http
|
||||
seq: 19
|
||||
seq: 11
|
||||
}
|
||||
|
||||
delete {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: DeletePerson
|
||||
type: http
|
||||
seq: 21
|
||||
seq: 9
|
||||
}
|
||||
|
||||
delete {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: GetContactInfosByPerson
|
||||
type: http
|
||||
seq: 18
|
||||
seq: 12
|
||||
}
|
||||
|
||||
get {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: GetMyself
|
||||
type: http
|
||||
seq: 22
|
||||
seq: 8
|
||||
}
|
||||
|
||||
get {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: GetPerson
|
||||
type: http
|
||||
seq: 23
|
||||
seq: 7
|
||||
}
|
||||
|
||||
get {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: InsertContactInfo
|
||||
type: http
|
||||
seq: 20
|
||||
seq: 10
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: Login
|
||||
type: http
|
||||
seq: 28
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: Register
|
||||
type: http
|
||||
seq: 29
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: RequestNewPassword
|
||||
type: http
|
||||
seq: 25
|
||||
seq: 5
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: ResetNewPassword
|
||||
type: http
|
||||
seq: 24
|
||||
seq: 6
|
||||
}
|
||||
|
||||
post {
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: UpdatePerson
|
||||
type: http
|
||||
seq: 26
|
||||
seq: 4
|
||||
}
|
||||
|
||||
patch {
|
@ -3,5 +3,5 @@ auth {
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjEsImlhdCI6MTc0NDk2OTAxNCwiZXhwIjoxNzQ0OTk3ODE0fQ.eAzcwzTPnNnqmmX9TCUroFLiJxQlQ49fGMVs1bXxXQM
|
||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwZXJzb25faWQiOjEsImlhdCI6MTc0OTU1MDM1OCwiZXhwIjoxNzQ5NTc5MTU4fQ.2oZk-agnonMEZw3cdf8bKjerTGpjLdxoglCiqfLVbyc
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ const Experience = require('../models/experience_model');
|
||||
const express = require('express');
|
||||
const jwtUtils = require('../utils/jwt_utils');
|
||||
|
||||
async function addExperience(req, res) {
|
||||
async function insert(req, res) {
|
||||
try {
|
||||
const experienceToInsert = Experience.createExperience(
|
||||
req.body.title,
|
||||
@ -29,15 +29,31 @@ async function addExperience(req, res) {
|
||||
const insertedExperience = await Experience.insert(experienceToInsert);
|
||||
return res.status(201).json(insertedExperience);
|
||||
} catch (error) {
|
||||
console.error(`Error in function ${addExperience.name}: ${error}`);
|
||||
console.error(`Error in function ${insert.name}: ${error}`);
|
||||
return res.status(500).json({
|
||||
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();
|
||||
routes.post('/', jwtUtils.extractToken, addExperience);
|
||||
routes.post('/', jwtUtils.extractToken, insert);
|
||||
routes.get('/:experienceId', jwtUtils.extractToken, find);
|
||||
|
||||
module.exports = {
|
||||
routes
|
||||
|
Reference in New Issue
Block a user