Initial commit after migration to gitea

This commit is contained in:
2026-01-18 11:27:43 +03:30
parent a21039410c
commit ea4b8eb543
196 changed files with 45567 additions and 9 deletions

View File

@@ -0,0 +1,103 @@
import { RequestManagementModel } from "src/request-management/entities/schema/request-management.schema";
export class AllRequestDto {
// TODO fix interface for class
firstPartyPlate: object;
secondPartyPlate: object;
secondPartyCar: string | undefined;
firstPartyCar: string | undefined;
requestId: string;
submitTime: string;
requestCode: string;
date: Date | string;
time: Date | string;
firstPartyDetail: Object | undefined;
secondPartyDetail: Object | undefined;
requestStatus: string;
lockFile: boolean | undefined;
lockTime: any;
userComment: boolean | null;
status: string;
partiesInitialForms: Object;
type: string;
constructor(request: RequestManagementModel) {
// TODO FIX THIS OBJECT AND CLASS FOR CLEAN CODE
this.requestId = request["_id"];
this.status = request.blameStatus;
this.userComment = this.userCommentVoid(request);
this.requestCode = request.requestNumber;
// Format date and time with Iran timezone (Asia/Tehran)
if (request.createdAt) {
const dateFormatOptions: Intl.DateTimeFormatOptions = {
timeZone: "Asia/Tehran",
year: "numeric",
month: "2-digit",
day: "2-digit",
};
const timeFormatOptions: Intl.DateTimeFormatOptions = {
timeZone: "Asia/Tehran",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
};
this.date = `${new Date(request.createdAt).toLocaleDateString("fa-IR", dateFormatOptions)} `;
this.time = new Date(request.createdAt).toLocaleTimeString("fa-IR", timeFormatOptions);
} else {
this.date = "";
this.time = "";
}
this.lockFile = request.lockFile;
this.lockTime = request.lockTime;
this.type = request.type || "THIRD_PARTY"; // Include type field, default to THIRD_PARTY for backward compatibility
this.partiesInitialForms = {
firstParty: Object.entries(
request.firstPartyDetails.firstPartyInitialForm,
)
.filter(([key, value]) => value)
.flat()[0],
secondParty: Object.entries(
request.secondPartyDetails.secondPartyInitialForm,
)
.filter(([key, value]) => (value ? key : null))
.flat()[0],
};
this.firstPartyCar =
request.firstPartyDetails?.firstPartyCarDetail?.carName;
this.secondPartyCar =
request.secondPartyDetails?.secondPartyCarDetail?.carName;
}
userCommentVoid(request: RequestManagementModel): boolean | null {
if (
request?.expertSubmitReply?.firstPartyComment &&
request?.expertSubmitReply?.secondPartyComment
) {
if (
request.expertSubmitReply.firstPartyComment.isAccept ||
request.expertSubmitReply.secondPartyComment.isAccept
) {
return true;
} else {
return false;
}
} else {
return null;
}
}
getFirstValidKey(obj: Record<string, boolean>) {
return (
Object.entries(obj).find(([_, value]) => value === true)?.[0] ?? null
);
}
}
export class AllRequestDtoRs {
public data;
constructor(requests: RequestManagementModel[]) {
this.data = requests.map((r) => new AllRequestDto(r));
}
}

View File

@@ -0,0 +1,72 @@
import { ApiProperty } from "@nestjs/swagger";
import { Types } from "mongoose";
import { BlameDocumentType } from "src/request-management/entities/schema/blame-document.schema";
export class AccidentWayIF {
@ApiProperty({ required: true })
id: string;
@ApiProperty({ required: true })
label: string;
}
export class AccidentReasonIF {
@ApiProperty({ required: true })
id: string;
@ApiProperty({ required: true })
label: string;
@ApiProperty({ required: true })
fanavaran: number;
}
export class FieldsInterface {
@ApiProperty({ required: true })
accidentWay: AccidentWayIF;
@ApiProperty({ required: true })
accidentReason: AccidentReasonIF;
@ApiProperty({ required: true })
accidentType: AccidentWayIF;
}
export class SubmitReplyDto {
@ApiProperty({ required: true })
description: string;
@ApiProperty({ required: true, type: Types.ObjectId })
guiltyUserId: Types.ObjectId;
@ApiProperty({ required: true })
fields: FieldsInterface;
}
export class ResendFirstPartyDto {
voice?: string;
userReply?: string;
@ApiProperty({ required: false })
firstPartyId: string | null;
@ApiProperty({ required: false })
firstPartyDescription: string | null;
documents?: { [key in BlameDocumentType]?: Types.ObjectId | string };
}
export class ResendSecondPartyDto {
voice?: string;
userReply?: string;
@ApiProperty({ required: false })
secondPartyId: string | null;
@ApiProperty({ required: false })
secondPartyDescription: string | null;
documents?: { [key in BlameDocumentType]?: Types.ObjectId | string };
}
export interface SendAginIF {
first: ResendFirstPartyDto;
second: ResendSecondPartyDto;
}