Skip to content

Commit 4d547d6

Browse files
committed
fix: issue at deployment
1 parent 707ffed commit 4d547d6

File tree

6 files changed

+71
-10
lines changed

6 files changed

+71
-10
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
SERVICE_ACCOUNT_PATH="./serviceAccountKey.json"
22
HOST=
3-
PORT=
3+
PORT=
4+
STORAGE_BUCKET="talentease-project.appspot.com"

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
# TalentEase API
1+
# Talentease
2+
Talentease is a career site or applicant tracking system (ATS) that helps companies to manage their hiring process. It is a mobile & web-based application that allows companies to advertise job openings on a single website.
3+
4+
## Tech Stack
5+
- Express JS
6+
- Firebase
7+
- Google Cloud Storage
8+
- Google Cloud Run
9+
- Google Load Balancer
10+
- Google Domains
11+
- Postman
12+
13+
## Features
14+
- Create a job posting
15+
- View all job postings
16+
- View a single job posting
17+
- Update a job posting
18+
- Delete a job posting
19+
- Apply for a job posting
20+
- View all applicants for a job posting
21+
- View a single applicant for a job posting
22+
- Update an applicant for a job posting
23+
- Delete an applicant for a job posting
24+
- View all applicants for all job postings
25+
- View a single applicant for all job postings
26+
- Update an applicant for all job postings
27+
- Delete an applicant for all job postings
28+
- View all job postings for an applicant
29+
- View a single job posting for an applicant
30+
- Add recruiter
31+
- View all recruiters
32+
33+
## API Documentation
34+
- [Postman Documentation](https://documenter.getpostman.com/view/27750616/2s93sgybbm)

config/firebaseAdmin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const admin = require('firebase-admin');
44
const serviceAccount = process.env.SERVICE_ACCOUNT || require('./firebaseAdminKey.json');
55

66
admin.initializeApp({
7-
credential: admin.credential.cert(serviceAccount),
8-
storageBucket: process.env.STORAGE_BUCKET,
7+
credential: admin.credential.cert(serviceAccount),
8+
storageBucket: process.env.STORAGE_BUCKET || 'talentease-project.appspot.com/CV',
99
});
1010

1111
const db = admin.firestore();

config/firebaseAdminKey.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"type": "service_account",
3+
"project_id": "talentease-project",
4+
"private_key_id": "387ad6b1ec70a2f4893c6d15fc3cd49b6d2f6b9e",
5+
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCqLThYU3KDcm6n\nmsrDB6W/X9Rmn/BkGFGSruFboMJHjPEC5cqhOX4xsJ9NmI0k5abDKRDoKcrVuv69\nhSL4Q6LMyTJeQqLLpY8DKT+ZwW4kkeLcIuOzT0SwuCbOyQTgGiUzXbC+6U+PI9Ht\nrWnjmSYZvVsqr1Zf6ZQrYdEQ64Lary/90MxqxLiiiLkJo5Ou1V5vhluWhyu8w4H6\nHOq810Mmf3d/1NZ49+vGPTalJwPwLXR/vN/TbApWlD1oZ17lLrLj2pOAf+lom7vD\nPM48tXakAFKP1UCoLLxFux+w8kq9xLePcBSN36ES5s2vCve+Msrr7uvBKjUJ2xSK\nF35CnGCdAgMBAAECggEAANfc8COCALMvWMmXHykYvFyT08UasJpsiNFzdsYxMlXP\ne6XLRiT2IAUB2zYLO4vAfORjikDAnXI5JxH170ZVEjLTtkKJcMrs6y+xTahdEzaS\n+LViPmvsydaJYOStyrN+Ha5pGSh9ceo8AfZUgpq5OGzdXxNu4zJp3o8LT1k0FtzZ\n0kAFaqX4PTHTDkH7T5RMi2wvLXIBzw64XnLGkzE8n2r60tjlKFFAK8w+rWnargKZ\njNQttFJ6+bvLlTJbYKBgtHNA99P9HAZ3CfbNp3dA2PVemP/ambD7vY42ilDREmks\nLA5ik4/6uu1ebnuIbqLhja2xgPtnZrxsZ1rfdmg2rwKBgQDhoct123EeIfwNPP/p\nTI7dDaN/SZgL+fo5tLiE41KYCWLe+J09sSgIrYSSKITKcBUfbzDGsuyUXZnsypnI\n1bo6yGXypEGun/CrpifbVaHkYnW499mFuIJ/cvIXxyZ/L2MAP7Gvb8/8B5d4jGZN\nL4PRfr46O/JyObGddeCrt8JQEwKBgQDBFLJ85SVIbkDZmHcJLUdIIIk6/9hdUhfd\nt7ggaMpyB/lhnKlKn8mbSO2ITTYKJZM+Tf6twHc9aKnNliTs2p4cLZvOoNHzRgqr\nmURvpIu9pGMmZ5zZudH/9X3rhY4aBz1UbarIJbHjCuxeqUFIRnr0QV5I9gGj3bUo\n/ZpB6viCjwKBgGufXQkObtpMo4k8+2QwnERcaQwh8mBkEDLOPOVF+POEJqDsPTRb\n+BiLi5ybrxtQcwLXapCcb7QlIXKNAOWG7Jl1VQtzxdChgY6eZox8QAhL3pMnxZ2+\n8KASF9+3omkwFSzdNMfVsYMpq9pYPcO7UkjvB5WHWpGZa1sMCupdcFX5AoGAd9TC\nmeUVaIiU0vdfGWDyln8q7GURAYoLqd119xdSXcc5LS2vm9Ljqu5uDWPuIAoGAmsh\nnvCOkJw+louSyzU7X72mr2z8IIHd6XYsFSYIXGCD8Lfpju9WuAbCacPv15OaqqWN\nkr5iUsjavj1JePPVJ3bSb3HOvsbAwnnynOqZ5V0CgYEAzaqcn4JCWO7h1dTgyxWf\nAExVY0w6oPPyMBBXMHRj2M6zrdg7YiJZmV0cRK1wYYh0Z+13Ei7h6X+VcMbuyJBP\n3ztvya1P3NELX/M8OFhkHIqE7cXUWYIg6vrSUN9KRafB8o/AZIGEEbM+Mu7ktg/A\nSBYqAsqcsY/CAVDZx/NrO60=\n-----END PRIVATE KEY-----\n",
6+
"client_email": "firebase-adminsdk-db1kq@talentease-project.iam.gserviceaccount.com",
7+
"client_id": "104298415803011019820",
8+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
9+
"token_uri": "https://oauth2.googleapis.com/token",
10+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
11+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-db1kq%40talentease-project.iam.gserviceaccount.com",
12+
"universe_domain": "googleapis.com"
13+
}

controllers/applicationController.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const createApplication = async (req, res) => {
2323
};
2424
try {
2525
const bucket = admin.storage().bucket();
26-
const filename = `${Date.now()}_${file.originalname}`;
26+
const filename = `CV/${candidateId}.pdf`;
2727
const fileUpload = bucket.file(filename);
2828
const stream = fileUpload.createWriteStream({
2929
metadata: {
@@ -54,26 +54,34 @@ const updateApplication = async (req, res) => {
5454
const recruiterId = req.user.uid;
5555
const { status } = req.body;
5656
const role = await ProfileModel.getRole(recruiterId);
57+
5758
if (role === 'recruiter' || role === 'admin') {
5859
const company = await ProfileModel.getCompany(recruiterId);
59-
const positionId = await ApplicationModel.getApplicationById(id);
60-
const position = await PositionModel.getPositionById(positionId.data().positionId);
60+
const applicationData = await ApplicationModel.getApplicationById(id);
61+
const { positionId } = applicationData;
62+
63+
const position = await PositionModel.getPositionById(positionId);
64+
6165
if (position.companyId !== company) {
6266
return responseError(res, 'Forbidden', 403);
6367
}
68+
6469
const application = {
6570
status, // 'pending', 'accepted', 'rejected
6671
updatedAt: new Date().toISOString(),
6772
};
73+
6874
const updatedApplication = await ApplicationModel.updateApplication(id, application);
75+
6976
if (updatedApplication) {
7077
return responseSuccess(res, { id, ...application }, 'Application updated successfully', 200);
7178
}
79+
7280
return responseError(res, 'Application update failed', 500);
7381
}
82+
7483
return responseError(res, 'Forbidden', 403);
7584
};
76-
7785
const getApplicationById = async (req, res) => {
7886
const id = req.params.applicationId;
7987
const recruiterId = req.user.uid;

routes/applicationRoutes.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ const {
1111
} = require('../controllers/applicationController');
1212

1313
const router = express.Router();
14-
const upload = multer({ storage: multer.memoryStorage() });
14+
const upload = multer({
15+
storage: multer.memoryStorage(),
16+
limits: {
17+
// no larger than 5mb.
18+
fileSize: 12 * 1024 * 1024,
19+
},
20+
});
1521

1622
router.get('/:applicationId', authenticateToken, getApplicationById);
1723
router.get('/position/:positionId', authenticateToken, getApplicationByPositionId);
1824
router.get('/user/:candidateId', authenticateToken, getApplicationByCandidateId);
19-
router.post('/create', authenticateToken, upload.single('file'), createApplication);
25+
router.post('/create', authenticateToken, upload.single('cv'), createApplication);
2026
router.patch('/:applicationId', authenticateToken, updateApplication);
2127

2228
module.exports = router;

0 commit comments

Comments
 (0)