Skip to content

Commit d07ead2

Browse files
committed
Merge branch 'orgs_model'
2 parents 061198b + 7a43971 commit d07ead2

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

volunteerverse-api/src/models/auth.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ export class Auth{
1818
throw error
1919
}
2020

21-
const user = await this.fetchByEmail(creds.email)
22-
console.log(user.rows)
23-
const {user_type} = user
21+
const user = await this.fetchByEmail(creds.email.trim())
22+
console.log(user)
23+
2424

2525
if (user){
26+
const {user_type} = user
2627
const isValid = await bcrypt.compare(creds.password, user.password)
2728
if (isValid===true){
2829
if (user_type==="volunteer"){

volunteerverse-api/src/models/organization.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ userType: "organization";
134134
const org_result = await db.query(
135135
`SELECT
136136
id,
137-
organization_name,
138-
organization_description,
137+
organization_name AS orgName,
138+
organization_description as orgDesc,
139139
organization_email AS "email",
140-
logo_url,
140+
logo_url AS imageUrl,
141141
founders
142142
FROM organizations
143143
WHERE organization_email = $1`, // this does to filtering to make sure we are being

volunteerverse-api/src/models/volunteer.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,4 @@ static async checkStatusProject(projectId:number, email:string){
280280
throw new BadRequestError(`${email} has not expressed interest in project ${projectId}`);
281281

282282
}
283-
284-
285-
286-
287-
288-
289283
}

volunteerverse-api/src/routes/volunteer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ volunteerRoutes.get("/skills", async function (req, res, next) {
1616
});
1717

1818
/** Route that handles when a volunteer expresses interest in a project - adds it to database */
19-
volunteerRoutes.put("/interest", async function (req, res, next) {
19+
volunteerRoutes.put("/interest/:projectId", async function (req, res, next) {
2020
try {
21-
const { email } = res.locals.user;
22-
const { projectId } = req.body;
21+
const projectId = parseInt(req.params.projectId);
22+
const {email } = res.locals.user;
23+
console.log("EMAIL VALUE IN VOLUNTEER: ", email)
24+
console.log("res.locals.user hereeee", res.locals.user)
2325
const result = await Volunteer.expressInterest(projectId, email);
2426
res.status(200).json(result);
2527
} catch (error) {

0 commit comments

Comments
 (0)