extend damageReport with noteByWorker
This commit is contained in:
parent
a208cdd158
commit
c02487ad3c
8 changed files with 18 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
export interface CreateDamageReportCommand {
|
||||
description: string;
|
||||
location: string;
|
||||
note: string;
|
||||
noteByReporter: string;
|
||||
reportedBy: string;
|
||||
images: string[];
|
||||
affectedId?: string;
|
||||
|
@ -11,6 +11,7 @@ export interface CreateDamageReportCommand {
|
|||
export interface UpdateDamageReportCommand {
|
||||
id: string;
|
||||
status: string;
|
||||
noteByWorker: string;
|
||||
done: boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export default abstract class DamageReportCommandHandler {
|
|||
status: "eingereicht",
|
||||
description: createDamageReport.description,
|
||||
location: createDamageReport.location,
|
||||
note: createDamageReport.note,
|
||||
noteByReporter: createDamageReport.noteByReporter,
|
||||
reportedBy: createDamageReport.reportedBy,
|
||||
images: createDamageReport.images,
|
||||
equipmentId: createDamageReport.affected == "equipment" ? createDamageReport.affectedId : null,
|
||||
|
@ -50,6 +50,7 @@ export default abstract class DamageReportCommandHandler {
|
|||
.update(damageReport)
|
||||
.set({
|
||||
status: updateDamageReport.status,
|
||||
noteByWorker: updateDamageReport.noteByWorker,
|
||||
done: updateDamageReport.done,
|
||||
})
|
||||
.where("id = :id", { id: updateDamageReport.id })
|
||||
|
|
|
@ -108,7 +108,7 @@ export async function createDamageReport(req: Request, res: Response): Promise<a
|
|||
let createDamageReport: CreateDamageReportCommand = {
|
||||
description,
|
||||
location,
|
||||
note,
|
||||
noteByReporter: note,
|
||||
reportedBy,
|
||||
images: images.map((i) => i.filename),
|
||||
affectedId,
|
||||
|
@ -128,11 +128,13 @@ export async function createDamageReport(req: Request, res: Response): Promise<a
|
|||
export async function updateDamageReportById(req: Request, res: Response): Promise<any> {
|
||||
const damageReportId = req.params.id;
|
||||
const status = req.body.status;
|
||||
const noteByWorker = req.body.noteByWorker;
|
||||
const done = req.body.done;
|
||||
|
||||
let updateDamageReport: UpdateDamageReportCommand = {
|
||||
id: damageReportId,
|
||||
status,
|
||||
noteByWorker,
|
||||
done,
|
||||
};
|
||||
await DamageReportCommandHandler.update(updateDamageReport);
|
||||
|
|
|
@ -129,7 +129,7 @@ export async function createDamageReport(req: Request, res: Response): Promise<a
|
|||
let createDamageReport: CreateDamageReportCommand = {
|
||||
description: description,
|
||||
location: location,
|
||||
note: note,
|
||||
noteByReporter: note,
|
||||
reportedBy: reportedBy,
|
||||
images: images.map((i) => i.filename),
|
||||
affectedId: related ? related.id : undefined,
|
||||
|
|
|
@ -25,7 +25,10 @@ export class damageReport {
|
|||
location: string;
|
||||
|
||||
@Column({ type: "text" })
|
||||
note: string;
|
||||
noteByReporter: string;
|
||||
|
||||
@Column({ type: "text" })
|
||||
noteByWorker: string;
|
||||
|
||||
@Column({
|
||||
type: "text",
|
||||
|
|
|
@ -46,7 +46,8 @@ export default abstract class DamageReportFactory {
|
|||
done: record.done,
|
||||
description: record.description,
|
||||
location: record.location,
|
||||
note: record.note,
|
||||
noteByReporter: record.noteByReporter,
|
||||
noteByWorker: record.noteByWorker,
|
||||
images: record.images,
|
||||
reportedBy: record?.reportedBy,
|
||||
...assigned,
|
||||
|
|
|
@ -10,7 +10,8 @@ export const damage_report_table = new Table({
|
|||
{ name: "done", ...getTypeByORM("boolean"), default: getDefaultByORM("boolean", false) },
|
||||
{ name: "description", ...getTypeByORM("text") },
|
||||
{ name: "location", ...getTypeByORM("text") },
|
||||
{ name: "note", ...getTypeByORM("text") },
|
||||
{ name: "noteByReporter", ...getTypeByORM("text") },
|
||||
{ name: "noteByWorker", ...getTypeByORM("text") },
|
||||
{ name: "reportedBy", ...getTypeByORM("varchar") },
|
||||
{ name: "imageCount", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) },
|
||||
{ name: "equipmentId", ...getTypeByORM("uuid", true) },
|
||||
|
|
|
@ -27,7 +27,8 @@ export type DamageReportViewModel = {
|
|||
done: boolean;
|
||||
description: string;
|
||||
location: string;
|
||||
note: string;
|
||||
noteByReporter: string;
|
||||
noteByWorker: string;
|
||||
images: string[];
|
||||
reportedBy: string;
|
||||
maintenance?: MaintenanceViewModel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue