made reject pqq by am api

This commit is contained in:
2025-11-27 19:47:04 +05:30
parent abe512b0c2
commit 75077c00da
3 changed files with 80 additions and 1 deletions

View File

@@ -94,7 +94,6 @@ updateMinglarProfile:
path: /minglaradmin/update-profile
method: patch
prepopulateRole:
handler: src/modules/minglaradmin/handlers/prepopulateRole.handler
memorySize: 384
@@ -313,6 +312,22 @@ acceptHostApplication:
path: /minglaradmin/hosthub/hosts/accept-host-application
method: patch
RejectPQQByAM:
handler: src/modules/minglaradmin/handlers/hosthub/hosts/rejectPQQbyAM.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/handlers/hosthub/hosts/**'
- 'src/modules/minglaradmin/services/**'
- ${file(./serverless/patterns/base.yml):pattern1}
- ${file(./serverless/patterns/base.yml):pattern2}
- ${file(./serverless/patterns/base.yml):pattern3}
- ${file(./serverless/patterns/base.yml):pattern4}
events:
- httpApi:
path: /minglaradmin/hosthub/hosts/reject-pqq-by-am
method: patch
acceptHostApplicationMinglar:
handler: src/modules/minglaradmin/handlers/hosthub/onboarding/acceptHostAppMinglar.handler
memorySize: 384

View File

@@ -0,0 +1,50 @@
import { verifyMinglarAdminToken } from '@/common/middlewares/jwt/authForMinglarAdmin';
import { MinglarService } from '@/modules/minglaradmin/services/minglar.service';
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda';
import { PrismaService } from '../../../../../common/database/prisma.service';
import { safeHandler } from '../../../../../common/utils/handlers/safeHandler';
import ApiError from '../../../../../common/utils/helper/ApiError';
const prismaService = new PrismaService();
const minglarService = new MinglarService(prismaService);
export const handler = safeHandler(async (
event: APIGatewayProxyEvent,
context?: Context
): Promise<APIGatewayProxyResult> => {
const token = event.headers['x-auth-token'] || event.headers['X-Auth-Token'];
if (!token) throw new ApiError(401, 'This is a protected route. Please provide a valid token.');
const userInfo = await verifyMinglarAdminToken(token);
let body: any = {};
try {
body = event.body ? JSON.parse(event.body) : {};
} catch (err) {
throw new ApiError(400, 'Invalid JSON in request body');
}
const { activityId } = body;
if (!activityId) {
throw new ApiError(400, 'activityId is required');
}
await minglarService.rejectPQQbyAM(
userInfo.id,
Number(activityId),
);
return {
statusCode: 201,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
body: JSON.stringify({
success: true,
message: 'Rejected successfully',
data: null,
}),
};
});

View File

@@ -4,6 +4,8 @@ import {
USER_STATUS,
} from '@/common/utils/constants/common.constant';
import {
ACTIVITY_DISPLAY_STATUS,
ACTIVITY_INTERNAL_STATUS,
HOST_STATUS_DISPLAY,
HOST_STATUS_INTERNAL,
STEPPER,
@@ -1221,4 +1223,16 @@ export class MinglarService {
},
});
}
async rejectPQQbyAM(user_xid: number, activityId: number) {
return await this.prisma.activities.update({
where: {
id: activityId
},
data: {
activityInternalStatus: ACTIVITY_INTERNAL_STATUS.REJECTED,
activityDisplayStatus: ACTIVITY_DISPLAY_STATUS.REJECTED,
}
})
}
}