feat: Add safety instructions and cancellations fields to activity details

This commit is contained in:
paritosh18
2026-02-25 14:41:58 +05:30
parent 89f1bf55bc
commit 3f96dd4ae1
4 changed files with 34 additions and 1 deletions

View File

@@ -1036,6 +1036,8 @@ model ActivityOtherDetails {
activityXid Int @map("activity_xid")
activity Activities @relation(fields: [activityXid], references: [id], onDelete: Cascade)
exclusiveNotes String? @map("exclusive_notes") @db.VarChar(500)
SafetyInstruction String? @map("safety_instruction") @db.VarChar(400)
Cancellations String? @map("cancellations") @db.VarChar(400)
dosNotes String? @map("dos_notes") @db.VarChar(400)
dontsNotes String? @map("donts_notes") @db.VarChar(400)
tipsNotes String? @map("tips_notes") @db.VarChar(400)

View File

@@ -86,10 +86,12 @@ export const EligibilityDto = z.object({
/* ================= OTHER DETAILS ================= */
export const OtherDetailsDto = z.object({
exclusiveNotes: z.string().optional(),
safetyInstruction: z.string().optional(),
dosNotes: z.string().optional(),
dontsNotes: z.string().optional(),
tipsNotes: z.string().optional(),
termsAndCondition: z.string().optional(),
cancellations: z.string().optional(),
});
/* ================= CREATE ACTIVITY ================= */

View File

@@ -1,4 +1,3 @@
import config from '../../../../../config/config';
import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
import { prismaClient } from '../../../../../common/database/prisma.lambda.service';
import { verifyHostToken } from '../../../../../common/middlewares/jwt/authForHost';
@@ -62,6 +61,20 @@ export const handler = safeHandler(
isCoverImage: m.isCoverImage ?? false,
}));
/* 4.1️⃣ ATTACH SAFETY INSTRUCTIONS (string only) */
if (activity.safetyInstruction !== undefined && activity.safetyInstruction !== null) {
if (typeof activity.safetyInstruction !== 'string') {
throw new ApiError(400, 'safetyInstruction must be a string');
}
}
/* 4.2️⃣ ATTACH CANCELLATIONS (string only) */
if (activity.cancellations !== undefined && activity.cancellations !== null) {
if (typeof activity.cancellations !== 'string') {
throw new ApiError(400, 'cancellations must be a string');
}
}
/* 5⃣ VALIDATION */
let parsedDto: CreateActivityInput;

View File

@@ -3494,6 +3494,22 @@ export class HostService {
data: {
activityXid,
exclusiveNotes: payload.otherDetails.exclusiveNotes ?? null,
SafetyInstruction: (() => {
const s = payload.otherDetails.safetyInstruction ?? null;
if (s === undefined || s === null) return null;
if (typeof s !== 'string') {
throw new ApiError(400, 'safetyInstruction must be a string');
}
return s;
})(),
Cancellations: (() => {
const c = payload.otherDetails.cancellations ?? null;
if (c === undefined || c === null) return null;
if (typeof c !== 'string') {
throw new ApiError(400, 'cancellations must be a string');
}
return c;
})(),
dosNotes: payload.otherDetails.dosNotes ?? null,
dontsNotes: payload.otherDetails.dontsNotes ?? null,
tipsNotes: payload.otherDetails.tipsNotes ?? null,