Commit 2b389c43 by Augusto

inspection Object update

parent ede124b8
......@@ -85,6 +85,30 @@ export class InspectionPhotoDto {
type: String,
})
description?: string;
@ApiProperty({
description:
'Order/position of the photo within the inspection (for sorting)',
example: 1,
type: Number,
})
order: number;
@ApiProperty({
description:
'Whether this photo is the principal/cover photo for the inspection',
example: false,
type: Boolean,
})
isPrincipal: boolean;
@ApiProperty({
description:
'Whether this photo is one of the 6 resume photos for the inspection',
example: false,
type: Boolean,
})
isResume: boolean;
}
export class InspectionDto {
......@@ -169,12 +193,17 @@ export class InspectionDto {
id: { type: 'number', example: 1 },
name: { type: 'string', example: 'John Doe' },
email: { type: 'string', example: 'john.doe@example.com' },
signature: {
type: 'string',
example: '/uploads/signatures/user_1_signature.png',
},
},
})
submittedBy?: {
id: number;
name: string;
email: string;
signature?: string;
};
@ApiPropertyOptional({
......@@ -184,12 +213,17 @@ export class InspectionDto {
id: { type: 'number', example: 2 },
name: { type: 'string', example: 'Jane Smith' },
email: { type: 'string', example: 'jane.smith@example.com' },
signature: {
type: 'string',
example: '/uploads/signatures/user_2_signature.png',
},
},
})
approvedBy?: {
id: number;
name: string;
email: string;
signature?: string;
};
@ApiProperty({
......
......@@ -274,6 +274,7 @@ export class InspectionService {
userId: users.id,
userName: users.name,
userEmail: users.email,
userSignature: users.signature,
})
.from(inspections)
.leftJoin(users, eq(users.id, inspections.submittedById))
......@@ -286,6 +287,7 @@ export class InspectionService {
userId: users.id,
userName: users.name,
userEmail: users.email,
userSignature: users.signature,
})
.from(inspections)
.leftJoin(users, eq(users.id, inspections.approvedById))
......@@ -298,6 +300,7 @@ export class InspectionService {
id: user.userId,
name: user.userName,
email: user.userEmail,
signature: user.userSignature,
});
}
});
......@@ -308,6 +311,7 @@ export class InspectionService {
id: user.userId,
name: user.userName,
email: user.userEmail,
signature: user.userSignature,
});
}
});
......@@ -365,6 +369,7 @@ export class InspectionService {
userId: users.id,
userName: users.name,
userEmail: users.email,
userSignature: users.signature,
})
.from(inspections)
.leftJoin(users, eq(users.id, inspections.submittedById))
......@@ -377,6 +382,7 @@ export class InspectionService {
userId: users.id,
userName: users.name,
userEmail: users.email,
userSignature: users.signature,
})
.from(inspections)
.leftJoin(users, eq(users.id, inspections.approvedById))
......@@ -388,6 +394,7 @@ export class InspectionService {
id: submittedByUser[0].userId,
name: submittedByUser[0].userName,
email: submittedByUser[0].userEmail,
signature: submittedByUser[0].userSignature,
});
}
......@@ -396,6 +403,7 @@ export class InspectionService {
id: approvedByUser[0].userId,
name: approvedByUser[0].userName,
email: approvedByUser[0].userEmail,
signature: approvedByUser[0].userSignature,
});
}
......@@ -986,6 +994,9 @@ export class InspectionService {
url: photo.url,
filename: photo.filename,
description: photo.description,
order: photo.order,
isPrincipal: photo.isPrincipal,
isResume: photo.isResume,
})),
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment