swagger updation for quotes and refund

This commit is contained in:
harshithnrao 2025-03-04 13:25:30 +05:30
parent 1d40b6544a
commit cd3678f9b0
4 changed files with 504 additions and 49 deletions

View File

@ -3,19 +3,80 @@ import { QuoteService } from './quotes.service';
import { Response } from 'express'; import { Response } from 'express';
import { GenericResponse } from 'src/common/GenericResponse.model'; import { GenericResponse } from 'src/common/GenericResponse.model';
import Quote from './quotes.entity'; import Quote from './quotes.entity';
import { ApiTags, ApiOperation, ApiResponse, ApiParam, ApiBody } from '@nestjs/swagger';
@ApiTags('quotes')
@Controller('quotes') @Controller('quotes')
export class QuoteController { export class QuoteController {
constructor(private quotesService: QuoteService) {} constructor(private quotesService: QuoteService) {}
@Get("/all") @Get("/all")
@ApiOperation({ summary: 'Get all quotes' })
@ApiResponse({
status: 200,
description: 'Successfully retrieved all quotes',
})
@ApiResponse({
status: 404,
description: 'No quotes found',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "No quotes found"
},
"data": null
}
})
async getAllQuotes(@Res() res: Response) { async getAllQuotes(@Res() res: Response) {
const response = await this.quotesService.findAll() || []; const response = await this.quotesService.findAll() || [];
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: 'No quotes found'
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
@Get(':id') @Get(':id')
@ApiOperation({ summary: 'Get quote by ID' })
@ApiParam({ name: 'id', type: Number, description: 'Quote ID' })
@ApiResponse({
status: 400,
description: 'ID is required',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NO_ID_REQ",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 404,
description: 'Quote not found',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "Quote not found"
},
"data": null
}
})
@ApiResponse({
status: 200,
description: 'Successfully retrieved quote by ID',
})
async findById(@Param('id') id: number, @Res() res: Response) { async findById(@Param('id') id: number, @Res() res: Response) {
if (!id) { if (!id) {
const response = new GenericResponse({ const response = new GenericResponse({
@ -24,15 +85,56 @@ export class QuoteController {
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
const response = await this.quotesService.findByPk(id) || {}; const response = await this.quotesService.findByPk(id) || {};
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: `Quote with ID ${id} not found`
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
@Post('/filter') @Post('/filter')
@ApiOperation({ summary: 'Filter quotes based on criteria' })
@ApiBody({ type: Quote, description: 'Filter criteria for quotes' })
@ApiResponse({
status: 400,
description: 'Filter criteria required',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NO_ID_REQ",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 404,
description: 'No quotes found based on the criteria',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "No quotes found based on the filter criteria"
},
"data": null
}
})
@ApiResponse({
status: 200,
description: 'Successfully filtered quotes',
})
async filter(@Body() quotes: Quote, @Res() res: Response) { async filter(@Body() quotes: Quote, @Res() res: Response) {
if (!quotes) { if (!quotes) {
const response = new GenericResponse({ const response = new GenericResponse({
@ -41,15 +143,43 @@ export class QuoteController {
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
const response = await this.quotesService.filter(quotes) || {}; const response = await this.quotesService.filter(quotes) || {};
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: 'No quotes found based on the filter criteria'
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
@Post() @Post()
@ApiOperation({ summary: 'Insert a new quote' })
@ApiBody({ type: Quote, description: 'Quote data to insert' })
@ApiResponse({
status: 400,
description: 'Invalid quote data',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.INVALID_DATA",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 201,
description: 'Quote successfully created',
})
async insert(@Body() quotes: Quote, @Res() res: Response) { async insert(@Body() quotes: Quote, @Res() res: Response) {
if (!quotes) { if (!quotes) {
const response = new GenericResponse({ const response = new GenericResponse({
@ -58,33 +188,106 @@ export class QuoteController {
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
delete quotes.id; delete quotes.id;
const response = await this.quotesService.upsert(quotes, true); const response = await this.quotesService.upsert(quotes, true);
const httpResponse = new GenericResponse(null, response) const httpResponse = new GenericResponse(null, response);
res.send(httpResponse); res.status(201).send(httpResponse);
} }
@Put() @Put()
@ApiOperation({ summary: 'Update an existing quote' })
@ApiBody({ type: Quote, description: 'Quote data to update' })
@ApiResponse({
status: 400,
description: 'Invalid quote data or ID is missing',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.INVALID_DATA",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 404,
description: 'Quote not found',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "Quote not found"
},
"data": null
}
})
@ApiResponse({
status: 200,
description: 'Quote successfully updated',
})
async update(@Body() quotes: Quote, @Res() res: Response) { async update(@Body() quotes: Quote, @Res() res: Response) {
if(!Quote || !quotes.id) { if (!quotes || !quotes.id) {
const response = new GenericResponse({ const response = new GenericResponse({
exception: true, exception: true,
exceptionSeverity: 'HIGH', exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
const response = await this.quotesService.upsert(quotes, false); const response = await this.quotesService.upsert(quotes, false);
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: `Quote with ID ${quotes.id} not found`
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
@Delete(':id') @Delete(':id')
@ApiOperation({ summary: 'Delete a quote by ID' })
@ApiParam({ name: 'id', type: Number, description: 'Quote ID to delete' })
@ApiResponse({
status: 400,
description: 'ID parameter is required',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NO_ID_REQ",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 404,
description: 'Quote not found',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "Quote not found"
},
"data": null
}
})
@ApiResponse({
status: 200,
description: 'Quote successfully deleted',
})
async deleteById(@Param('id') id: number, @Res() res: Response) { async deleteById(@Param('id') id: number, @Res() res: Response) {
if (!id) { if (!id) {
const response = new GenericResponse({ const response = new GenericResponse({
@ -93,11 +296,20 @@ export class QuoteController {
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
const response = await this.quotesService.remove(id) || {}; const response = await this.quotesService.remove(id) || {};
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: `Quote with ID ${id} not found`
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
} }

View File

@ -1,52 +1,68 @@
import { Table, Column, Model, Default, DataType } from 'sequelize-typescript'; import { Table, Column, Model, Default, DataType } from 'sequelize-typescript';
import { ApiProperty } from '@nestjs/swagger';
@Table({ tableName: 'quotes', paranoid: true }) @Table({ tableName: 'quotes', paranoid: true })
export default class Quote extends Model { export default class Quote extends Model {
@ApiProperty({ type: Number })
@Column(DataType.BIGINT) @Column(DataType.BIGINT)
user_id: number; user_id: number;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
user_email: string; user_email: string;
@ApiProperty({ type: Number })
@Column(DataType.BIGINT) @Column(DataType.BIGINT)
institute_id: number; institute_id: number;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
quote_type: string; quote_type: string;
@ApiProperty({ type: Number })
@Column(DataType.NUMBER) @Column(DataType.NUMBER)
quote_est: number; quote_est: number;
@ApiProperty({ type: Number })
@Column(DataType.NUMBER) @Column(DataType.NUMBER)
cust_estimate: number; cust_estimate: number;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
status: string; status: string;
@ApiProperty({ type: Date, default: new Date() })
@Default(new Date()) @Default(new Date())
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
validFrom: Date; validFrom: Date;
@ApiProperty({ type: Date, default: new Date("2070-12-31") })
@Default(new Date("2070-12-31")) @Default(new Date("2070-12-31"))
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
validTill: Date; validTill: Date;
@ApiProperty({ type: Date })
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
createdAt: Date; createdAt: Date;
@ApiProperty({ type: Date })
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
updatedAt: Date; updatedAt: Date;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
createdBy: string; createdBy: string;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
modifiedBy: string; modifiedBy: string;
@ApiProperty({ type: Date })
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
deletedAt: Date; deletedAt: Date;
@ApiProperty({ type: Number })
@Column(DataType.NUMBER) @Column(DataType.NUMBER)
version: number; version: number;
} }

View File

@ -3,19 +3,80 @@ import { Response } from 'express';
import { GenericResponse } from 'src/common/GenericResponse.model'; import { GenericResponse } from 'src/common/GenericResponse.model';
import { RefundService } from './refund.service'; import { RefundService } from './refund.service';
import Refund from './refund.entity'; import Refund from './refund.entity';
import { ApiTags, ApiOperation, ApiResponse, ApiParam, ApiBody } from '@nestjs/swagger';
@ApiTags('refunds')
@Controller('refunds') @Controller('refunds')
export class RefundController { export class RefundController {
constructor(private refundsService: RefundService) {} constructor(private refundsService: RefundService) {}
@Get("/all") @Get("/all")
@ApiOperation({ summary: 'Get all refunds' })
@ApiResponse({
status: 200,
description: 'Successfully retrieved all refunds',
})
@ApiResponse({
status: 404,
description: 'No refunds found',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "No refunds found"
},
"data": null
}
})
async getAll(@Res() res: Response) { async getAll(@Res() res: Response) {
const response = await this.refundsService.findAll() || []; const response = await this.refundsService.findAll() || [];
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: 'No refunds found'
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
@Get(':id') @Get(':id')
@ApiOperation({ summary: 'Get refund by ID' })
@ApiParam({ name: 'id', type: Number, description: 'Refund ID' })
@ApiResponse({
status: 400,
description: 'ID is required',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NO_ID_REQ",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 404,
description: 'Refund not found',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "Refund not found"
},
"data": null
}
})
@ApiResponse({
status: 200,
description: 'Successfully retrieved refund by ID',
})
async findById(@Param('id') id: number, @Res() res: Response) { async findById(@Param('id') id: number, @Res() res: Response) {
if (!id) { if (!id) {
const response = new GenericResponse({ const response = new GenericResponse({
@ -24,32 +85,101 @@ export class RefundController {
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
const response = await this.refundsService.findByPk(id) || {}; const response = await this.refundsService.findByPk(id) || {};
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: `Refund with ID ${id} not found`
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
@Post('/filter') @Post('/filter')
@ApiOperation({ summary: 'Filter refunds based on criteria' })
@ApiBody({ type: Refund, description: 'Filter criteria for refunds' })
@ApiResponse({
status: 400,
description: 'Invalid filter criteria',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.INVALID_CRITERIA",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 404,
description: 'No refunds found based on the criteria',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "No refunds found based on the criteria"
},
"data": null
}
})
@ApiResponse({
status: 200,
description: 'Successfully filtered refunds',
})
async filter(@Body() refund: Refund, @Res() res: Response) { async filter(@Body() refund: Refund, @Res() res: Response) {
if (!refund) { if (!refund) {
const response = new GenericResponse({ const response = new GenericResponse({
exception: true, exception: true,
exceptionSeverity: 'HIGH', exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.INVALID_CRITERIA',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
const response = await this.refundsService.filter(refund) || {}; const response = await this.refundsService.filter(refund) || {};
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: 'No refunds found based on the filter criteria'
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
@Post() @Post()
@ApiOperation({ summary: 'Insert a new refund' })
@ApiBody({ type: Refund, description: 'Refund data to insert' })
@ApiResponse({
status: 400,
description: 'Invalid refund data',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.INVALID_DATA",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 201,
description: 'Refund successfully created',
})
async insert(@Body() refund: Refund, @Res() res: Response) { async insert(@Body() refund: Refund, @Res() res: Response) {
if (!refund) { if (!refund) {
const response = new GenericResponse({ const response = new GenericResponse({
@ -58,16 +188,48 @@ export class RefundController {
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
delete refund.id; delete refund.id;
const response = await this.refundsService.upsert(refund, true); const response = await this.refundsService.upsert(refund, true);
const httpResponse = new GenericResponse(null, response) const httpResponse = new GenericResponse(null, response);
res.send(httpResponse); res.status(201).send(httpResponse);
} }
@Put() @Put()
@ApiOperation({ summary: 'Update an existing refund' })
@ApiBody({ type: Refund, description: 'Refund data to update' })
@ApiResponse({
status: 400,
description: 'Invalid refund data or ID missing',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.INVALID_DATA",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 404,
description: 'Refund not found',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "Refund not found"
},
"data": null
}
})
@ApiResponse({
status: 200,
description: 'Refund successfully updated',
})
async update(@Body() refund: Refund, @Res() res: Response) { async update(@Body() refund: Refund, @Res() res: Response) {
if (!refund || !refund.id) { if (!refund || !refund.id) {
const response = new GenericResponse({ const response = new GenericResponse({
@ -76,15 +238,56 @@ export class RefundController {
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
const response = await this.refundsService.upsert(refund, false); const response = await this.refundsService.upsert(refund, false);
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: `Refund with ID ${refund.id} not found`
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
@Delete(':id') @Delete(':id')
@ApiOperation({ summary: 'Delete a refund by ID' })
@ApiParam({ name: 'id', type: Number, description: 'Refund ID to delete' })
@ApiResponse({
status: 400,
description: 'ID parameter is required',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NO_ID_REQ",
"stackTrace": "Request"
},
"data": null
}
})
@ApiResponse({
status: 404,
description: 'Refund not found',
example: {
"notification": {
"exception": true,
"exceptionSeverity": "HIGH",
"exceptionMessage": "ERR.NOT_FOUND",
"stackTrace": "Refund not found"
},
"data": null
}
})
@ApiResponse({
status: 200,
description: 'Refund successfully deleted',
})
async deleteById(@Param('id') id: number, @Res() res: Response) { async deleteById(@Param('id') id: number, @Res() res: Response) {
if (!id) { if (!id) {
const response = new GenericResponse({ const response = new GenericResponse({
@ -93,11 +296,20 @@ export class RefundController {
exceptionMessage: 'ERR.NO_ID_REQ', exceptionMessage: 'ERR.NO_ID_REQ',
stackTrace: 'Request' stackTrace: 'Request'
}, null); }, null);
res.send(response); res.status(400).send(response);
return; return;
} }
const response = await this.refundsService.remove(id) || {}; const response = await this.refundsService.remove(id) || {};
const httpResponse = new GenericResponse(null, response) if (!response) {
res.send(httpResponse); const errorResponse = new GenericResponse({
exception: true,
exceptionSeverity: 'HIGH',
exceptionMessage: 'ERR.NOT_FOUND',
stackTrace: `Refund with ID ${id} not found`
}, null);
return res.status(404).send(errorResponse);
}
const httpResponse = new GenericResponse(null, response);
res.status(200).send(httpResponse);
} }
} }

View File

@ -1,49 +1,64 @@
import { Table, Column, Model, Default, DataType } from 'sequelize-typescript'; import { Table, Column, Model, Default, DataType } from 'sequelize-typescript';
import { ApiProperty } from '@nestjs/swagger';
@Table({ tableName: 'refund', paranoid: true }) @Table({ tableName: 'refund', paranoid: true })
export default class Refund extends Model { export default class Refund extends Model {
@ApiProperty({ type: Number })
@Column(DataType.BIGINT) @Column(DataType.BIGINT)
payment_id: number; payment_id: number;
@ApiProperty({ type: Number })
@Column(DataType.NUMBER) @Column(DataType.NUMBER)
amount: number; amount: number;
@ApiProperty({ type: Date })
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
refund_date: Date; refund_date: Date;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
reason: string; reason: string;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
to_account: string; to_account: string;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
status: string; status: string;
@ApiProperty({ type: Date, default: new Date() })
@Default(new Date()) @Default(new Date())
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
validFrom: Date; validFrom: Date;
@ApiProperty({ type: Date, default: new Date("2070-12-31") })
@Default(new Date("2070-12-31")) @Default(new Date("2070-12-31"))
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
validTill: Date; validTill: Date;
@ApiProperty({ type: Date })
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
createdAt: Date; createdAt: Date;
@ApiProperty({ type: Date })
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
updatedAt: Date; updatedAt: Date;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
createdBy: string; createdBy: string;
@ApiProperty({ type: String })
@Column(DataType.TEXT) @Column(DataType.TEXT)
modifiedBy: string; modifiedBy: string;
@ApiProperty({ type: Date })
@Column(DataType.DATEONLY) @Column(DataType.DATEONLY)
deletedAt: Date; deletedAt: Date;
@ApiProperty({ type: Number })
@Column(DataType.NUMBER) @Column(DataType.NUMBER)
version: number; version: number;
} }