File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,17 +3,18 @@ import * as memberService from "../services/member.service";
33import { ApiError } from "../utils/apiError" ;
44import { deleteImage , uploadImage } from "../utils/imageUtils" ;
55import { SupabaseClient } from "@supabase/supabase-js" ;
6+ import { password } from "bun" ;
67
78// List all approved members
89export const listAllApprovedMembers = async ( req : Request , res : Response ) => {
910
10- const { email} = req . query ;
11+ const { email, password } = req . query ;
1112
1213 if ( email ) {
1314
14- const user = await memberService . getUserByEmail ( email as string ) ;
15+ const user = await memberService . getUserByEmail ( email as string , password as string ) ;
1516
16- if ( ! user ) throw new ApiError ( 'Incorrect email' , 400 ) ;
17+ if ( ! user ) throw new ApiError ( 'Incorrect email or password ' , 400 ) ;
1718
1819 res . status ( 200 ) . json ( {
1920 success : true ,
Original file line number Diff line number Diff line change 11import { prisma } from "../db/client" ;
22import { ApiError } from "../utils/apiError" ;
33
4- export const getUserByEmail = async ( email : string ) => {
4+ export const getUserByEmail = async ( email : string , hashedPassword : string ) => {
55 return await prisma . member . findUnique ( {
66 where : {
77 email : email
88 } ,
99 select : {
1010 id : true ,
11+ isApproved : true ,
12+ isManager : true ,
1113 accounts : {
1214 where : {
1315 provider : 'credentials' ,
14- } ,
15- select : {
16- password : true ,
16+ password : hashedPassword ,
1717 } ,
1818 } ,
1919 }
You can’t perform that action at this time.
0 commit comments