Skip to content

Commit 43bf031

Browse files
Merge pull request #28 from call-0f-code/minor-fixes
Temporary fix to a big f up
2 parents 6cdec37 + 805f3ca commit 43bf031

5 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/controllers/member.controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { Request, Response } from "express";
22
import * as memberService from "../services/member.service";
33
import { ApiError } from "../utils/apiError";
4-
import { deleteImage, uploadImage } from "../utils/imageUtils";
4+
import { uploadImage } from "../utils/imageUtils";
55
import { SupabaseClient } from "@supabase/supabase-js";
66

77
// List all approved members
88
export const listAllApprovedMembers = async (req: Request, res: Response) => {
99

10-
const {email, password} = req.query;
10+
const {email} = req.query;
1111

12-
if(email && password) {
12+
if(email) {
1313

1414
const user = await memberService.getUserByEmail(email as string);
1515

@@ -58,10 +58,10 @@ export const createAMember =
5858
const user = await memberService.createMember(
5959
email,
6060
name,
61+
provider,
6162
password,
6263
passoutYear,
6364
imageUrl,
64-
provider,
6565
);
6666

6767
if (!user) throw new ApiError("Error creating user", 500);

src/routes/achievements.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import express from 'express';
22
import * as acheivementsCtrl from '../controllers/achievement.controller';
3-
import { supabase } from '../app';
43
import { Multer } from 'multer';
54
import { SupabaseClient } from '@supabase/supabase-js';
65

src/routes/members.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import express from "express";
22
import * as memberCtrl from "../controllers/member.controller";
33
import { Multer } from "multer";
4-
import { supabase } from "../app";
54
import { SupabaseClient } from "@supabase/supabase-js";
65

76
export default function membersRouter(

src/routes/progress.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@ export default function progressRouter() {
1515
* @apiParam {String} memberId ID of the member to retrieve completed questions for.
1616
*
1717
* @apiSuccess {String="SUCCESS"} status Response status.
18-
* @apiSuccess {Object[]} completedQuestion List of completed questions.
19-
* @apiSuccess {Number} completedQuestion.questionId Id of the completed question.
18+
* @apiSuccess {Object[]} completedQuestion List of questions inside the topic.
19+
* @apiSuccess {Object} completedQuestion[].question Question object.
20+
* @apiSuccess {Number} completedQuestion[].question.id Question ID.
21+
* @apiSuccess {String} completedQuestion[].question.questionName Name of the question.
22+
* @apiSuccess {String} completedQuestion[].question.link Link to the question.
23+
* @apiSuccess {String="Easy","Medium","Hard"} completedQuestion[].question.difficulty Difficulty level of the question.
24+
* @apiSuccess {Number} completedQuestion[].question.topicId Topic ID associated with the question.
25+
* @apiSuccess {Number} completedQuestion[].question.createdAt Timestamp when the question was created (Unix timestamp).
26+
* @apiSuccess {Number} completedQuestion[].question.updatedAt Timestamp when the question was last updated (Unix timestamp).
27+
* @apiSuccess {String} completedQuestion[].question.createdById ID of the user who created the question.
28+
* @apiSuccess {String} completedQuestion[].question.updatedById ID of the user who last updated the question.
2029
*
2130
* @apiError (Error 400) BadRequest Missing required fields.
2231
* @apiError (Error 500) InternalServerError Error while fetching completed questions.

src/services/member.service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ export const getUserByEmail = async(email: string) => {
1111
isApproved: true,
1212
isManager: true,
1313
accounts: {
14-
where: {
15-
provider: 'credentials',
16-
},
1714
select: {
1815
password: true
1916
}
@@ -42,9 +39,9 @@ export const createMember = async (
4239
email: string,
4340
name: string,
4441
provider: "google" | "github" | "credentials",
42+
password?: string,
4543
passoutYear?: number,
4644
imageUrl?: string,
47-
password?: string
4845
) => {
4946
const newMember = await prisma.member.create({
5047
data: {

0 commit comments

Comments
 (0)