unit/#126-repairs #128
8 changed files with 12 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
export interface CreateDamageReportCommand {
|
export interface CreateDamageReportCommand {
|
||||||
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
location: string;
|
location: string;
|
||||||
noteByReporter: string;
|
noteByReporter: string;
|
||||||
|
|
|
@ -21,6 +21,7 @@ export default abstract class DamageReportCommandHandler {
|
||||||
.into(damageReport)
|
.into(damageReport)
|
||||||
.values({
|
.values({
|
||||||
status: "eingereicht",
|
status: "eingereicht",
|
||||||
|
title: createDamageReport.title,
|
||||||
description: createDamageReport.description,
|
description: createDamageReport.description,
|
||||||
location: createDamageReport.location,
|
location: createDamageReport.location,
|
||||||
noteByReporter: createDamageReport.noteByReporter,
|
noteByReporter: createDamageReport.noteByReporter,
|
||||||
|
|
|
@ -94,6 +94,7 @@ export async function provideDamageReportImageUpload(req: Request, res: Response
|
||||||
* @returns {Promise<*>}
|
* @returns {Promise<*>}
|
||||||
*/
|
*/
|
||||||
export async function createDamageReport(req: Request, res: Response): Promise<any> {
|
export async function createDamageReport(req: Request, res: Response): Promise<any> {
|
||||||
|
const title = req.body.title;
|
||||||
const description = req.body.description;
|
const description = req.body.description;
|
||||||
const location = req.body.location;
|
const location = req.body.location;
|
||||||
const note = req.body.note;
|
const note = req.body.note;
|
||||||
|
@ -106,6 +107,7 @@ export async function createDamageReport(req: Request, res: Response): Promise<a
|
||||||
throw new BadRequestException("set assigned to equipment or vehicle or wearable");
|
throw new BadRequestException("set assigned to equipment or vehicle or wearable");
|
||||||
|
|
||||||
let createDamageReport: CreateDamageReportCommand = {
|
let createDamageReport: CreateDamageReportCommand = {
|
||||||
|
title,
|
||||||
description,
|
description,
|
||||||
location,
|
location,
|
||||||
noteByReporter: note,
|
noteByReporter: note,
|
||||||
|
|
|
@ -120,6 +120,7 @@ export async function createDamageReport(req: Request, res: Response): Promise<a
|
||||||
| MinifiedEquipmentViewModel
|
| MinifiedEquipmentViewModel
|
||||||
| MinifiedVehicleViewModel
|
| MinifiedVehicleViewModel
|
||||||
| MinifiedWearableViewModel;
|
| MinifiedWearableViewModel;
|
||||||
|
const title = req.body.title;
|
||||||
const description = req.body.description;
|
const description = req.body.description;
|
||||||
const location = req.body.location;
|
const location = req.body.location;
|
||||||
const note = req.body.note;
|
const note = req.body.note;
|
||||||
|
@ -127,6 +128,7 @@ export async function createDamageReport(req: Request, res: Response): Promise<a
|
||||||
const images = req.files as Express.Multer.File[];
|
const images = req.files as Express.Multer.File[];
|
||||||
|
|
||||||
let createDamageReport: CreateDamageReportCommand = {
|
let createDamageReport: CreateDamageReportCommand = {
|
||||||
|
title: title,
|
||||||
description: description,
|
description: description,
|
||||||
location: location,
|
location: location,
|
||||||
noteByReporter: note,
|
noteByReporter: note,
|
||||||
|
|
|
@ -18,6 +18,9 @@ export class damageReport {
|
||||||
@Column({ type: "boolean", default: false })
|
@Column({ type: "boolean", default: false })
|
||||||
done: boolean;
|
done: boolean;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
title: string;
|
||||||
|
|
||||||
@Column({ type: "text" })
|
@Column({ type: "text" })
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ export default abstract class DamageReportFactory {
|
||||||
reportedAt: record.reportedAt,
|
reportedAt: record.reportedAt,
|
||||||
status: record.status,
|
status: record.status,
|
||||||
done: record.done,
|
done: record.done,
|
||||||
|
title: record.title,
|
||||||
description: record.description,
|
description: record.description,
|
||||||
location: record.location,
|
location: record.location,
|
||||||
noteByReporter: record.noteByReporter,
|
noteByReporter: record.noteByReporter,
|
||||||
|
|
|
@ -8,6 +8,7 @@ export const damage_report_table = new Table({
|
||||||
{ name: "reportedAt", ...getTypeByORM("datetime"), default: getDefaultByORM("currentTimestamp") },
|
{ name: "reportedAt", ...getTypeByORM("datetime"), default: getDefaultByORM("currentTimestamp") },
|
||||||
{ name: "status", ...getTypeByORM("varchar") },
|
{ name: "status", ...getTypeByORM("varchar") },
|
||||||
{ name: "done", ...getTypeByORM("boolean"), default: getDefaultByORM("boolean", false) },
|
{ name: "done", ...getTypeByORM("boolean"), default: getDefaultByORM("boolean", false) },
|
||||||
|
{ name: "title", ...getTypeByORM("varchar") },
|
||||||
{ name: "description", ...getTypeByORM("text") },
|
{ name: "description", ...getTypeByORM("text") },
|
||||||
{ name: "location", ...getTypeByORM("text") },
|
{ name: "location", ...getTypeByORM("text") },
|
||||||
{ name: "noteByReporter", ...getTypeByORM("text") },
|
{ name: "noteByReporter", ...getTypeByORM("text") },
|
||||||
|
|
|
@ -23,6 +23,7 @@ export type DamageReportAssigned = {
|
||||||
|
|
||||||
export type DamageReportViewModel = {
|
export type DamageReportViewModel = {
|
||||||
id: string;
|
id: string;
|
||||||
|
title: string;
|
||||||
reportedAt: Date;
|
reportedAt: Date;
|
||||||
status: string;
|
status: string;
|
||||||
done: boolean;
|
done: boolean;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue