feat(payment-method): add
feat(card-type): add
This commit is contained in:
369
src/controllers/card_type.ts
Normal file
369
src/controllers/card_type.ts
Normal file
@ -0,0 +1,369 @@
|
|||||||
|
import { Response, NextFunction, Application } from "express";
|
||||||
|
import { Request } from "express-jwt";
|
||||||
|
import { ReturnHelper } from "../helpers/express/return";
|
||||||
|
import { OrmHelper } from "../helpers/orm";
|
||||||
|
import Joi from "joi";
|
||||||
|
import { ILogObj, Logger } from "tslog";
|
||||||
|
import { Language } from "../langs/lang";
|
||||||
|
import { Paging, CardType } from "entity";
|
||||||
|
import CommonHelper from "../helpers/common";
|
||||||
|
import * as fastcsv from 'fast-csv';
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { CardTypeModel } from "../model/card_type";
|
||||||
|
|
||||||
|
const log: Logger<ILogObj> = new Logger({ name: '[CardTypeController]', type: 'pretty' });
|
||||||
|
|
||||||
|
export class CardTypeController {
|
||||||
|
static async list(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['CardType']
|
||||||
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
#swagger.parameters['filter'] = { description: '', in: 'query', type: 'string' }
|
||||||
|
#swagger.parameters['limit'] = { in: 'query', required: true, type: 'number' }
|
||||||
|
#swagger.parameters['page'] = { in: 'query', required: true, type: 'number' }
|
||||||
|
#swagger.parameters['with_deleted'] = { in: 'query', required: true, type: 'boolean' }
|
||||||
|
#swagger.parameters['order_field'] = { in: 'query', required: true, type: 'string' }
|
||||||
|
#swagger.parameters['order_direction'] = { in: 'query', required: true, schema: { '@enum': ['ASC', 'DESC'] } }
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
filter: Joi.string().allow("").optional().label("Filter"),
|
||||||
|
page: Joi.number().required().min(1).label("Page"),
|
||||||
|
limit: Joi.number().required().min(1).label("Limit"),
|
||||||
|
with_deleted: Joi.bool().required().label("With Deleted"),
|
||||||
|
order_field: Joi.string().required().label("Order Field"),
|
||||||
|
order_direction: Joi.string().allow("asc", "desc").required().label("Order Direction"),
|
||||||
|
});
|
||||||
|
|
||||||
|
let param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|
||||||
|
let filter = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
|
||||||
|
let filterAny = filter.any && filter.any !== "" ? filter.any : "";
|
||||||
|
|
||||||
|
let filterObj = { ...filter } as any;
|
||||||
|
delete filterObj.any;
|
||||||
|
filterObj = { ...filterObj };
|
||||||
|
|
||||||
|
var query = await CardTypeModel.list(filterObj, filterAny);
|
||||||
|
|
||||||
|
const offset = (param.page - 1) * param.limit;
|
||||||
|
let limit = param.limit;
|
||||||
|
|
||||||
|
const res_count = query;
|
||||||
|
const res_list = query
|
||||||
|
.orderBy("card_type." + param.order_field, param.order_direction)
|
||||||
|
.offset(offset)
|
||||||
|
.limit(limit);
|
||||||
|
|
||||||
|
if (param.with_deleted) {
|
||||||
|
res_count.withDeleted();
|
||||||
|
res_list.withDeleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
const current_page = param.page;
|
||||||
|
const total_count_data = await res_count.getCount();
|
||||||
|
const list_data = await res_list.getMany();
|
||||||
|
const count_data = CommonHelper.countObject(list_data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponselist(res, 200, Language.lang.success_view, count_data, current_page, total_count_data, list_data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['CardType']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['filter'] = {
|
||||||
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
|
in: 'query',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['filter'] = {
|
||||||
|
in: 'query',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['order_field'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['order_direction'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
schema: {
|
||||||
|
'@enum': ['ASC', 'DESC']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|
||||||
|
let filter = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
|
||||||
|
|
||||||
|
var query = await CardTypeModel.list(filter);
|
||||||
|
const data = await query.getMany();
|
||||||
|
|
||||||
|
const filename = "card_type.csv";
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'text/csv');
|
||||||
|
res.setHeader('Content-Disposition', 'attachment; filename=' + filename);
|
||||||
|
|
||||||
|
const csvStream = fastcsv.format({
|
||||||
|
headers: true,
|
||||||
|
writeHeaders: true,
|
||||||
|
transform: (row: CardType): any => ({
|
||||||
|
...row,
|
||||||
|
created_at: dayjs(row.created_at).format('DD-MM-YYYY HH:MM:ss'),
|
||||||
|
})
|
||||||
|
});
|
||||||
|
csvStream.pipe(res);
|
||||||
|
|
||||||
|
const limit = 50;
|
||||||
|
|
||||||
|
const fetchAndWrite = async (page: any) => {
|
||||||
|
|
||||||
|
if (CommonHelper.countObject(data) === 0) {
|
||||||
|
csvStream.end();
|
||||||
|
} else {
|
||||||
|
data.forEach((item: any) => csvStream.write(item));
|
||||||
|
|
||||||
|
if (CommonHelper.countObject(data) == limit) {
|
||||||
|
fetchAndWrite(page + 1);
|
||||||
|
} else {
|
||||||
|
csvStream.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchAndWrite(1);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async create(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['CardType']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
|
||||||
|
#swagger.requestBody = {
|
||||||
|
required: true,
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: {
|
||||||
|
$ref: "#/components/schemas/card_type"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
name: Joi.string().max(256).required().label('Name'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: any = await schema.validateAsync(req.body);
|
||||||
|
|
||||||
|
const data = new CardType()
|
||||||
|
data.name = param.name;
|
||||||
|
data.created_by = req.auth.data.name;
|
||||||
|
data.updated_by = req.auth.data.name;
|
||||||
|
|
||||||
|
await OrmHelper.DB.manager.save(data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_insert, data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 401, Language.lang.failed_insert, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async update(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['CardType']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'CardType ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
|
||||||
|
#swagger.requestBody = {
|
||||||
|
required: true,
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: {
|
||||||
|
$ref: "#/components/schemas/card_type"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID'),
|
||||||
|
name: Joi.string().max(256).required().label('Name'),
|
||||||
|
});
|
||||||
|
|
||||||
|
req.body.id = req.params['id'];
|
||||||
|
|
||||||
|
const param: any = await schema.validateAsync(req.body);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(CardType);
|
||||||
|
|
||||||
|
const data = await repo.findOneBy({ id: param.id });
|
||||||
|
|
||||||
|
if (data != null) {
|
||||||
|
data.name = param.name;
|
||||||
|
data.updated_by = req.auth.data.name;
|
||||||
|
|
||||||
|
await repo.save(data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_update, data);
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_update, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async delete(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['CardType']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'CardType ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['hard'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'Is Hard Delete',
|
||||||
|
required: false,
|
||||||
|
type: 'boolean'
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID'),
|
||||||
|
hard: Joi.bool().optional().allow('').label('Is hard delete?')
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: { id: string, hard: boolean } = await schema.validateAsync(req.params);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(CardType);
|
||||||
|
|
||||||
|
const existData = await repo.findOne({ where: { id: param.id } });
|
||||||
|
if (existData && !param.hard) {
|
||||||
|
existData.deleted_by = req.auth.data.name;
|
||||||
|
await OrmHelper.DB.manager.save(existData);
|
||||||
|
}
|
||||||
|
|
||||||
|
const affected = (!param.hard ? await repo.softDelete({ id: param.id }) : await repo.delete({ id: param.id })).affected;
|
||||||
|
|
||||||
|
if (affected > 0) {
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_delete, {});
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_delete, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async restore(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['CardType']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'CardType ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID')
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: any = await schema.validateAsync(req.params);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(CardType);
|
||||||
|
|
||||||
|
const affected = (await repo.restore({ id: param.id })).affected;
|
||||||
|
|
||||||
|
if (affected > 0) {
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_restore, {});
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_restore, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async detail(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['CardType']
|
||||||
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
#swagger.parameters['id'] = { description: '', in: 'path', type: 'string' }
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label("CardType Id"),
|
||||||
|
});
|
||||||
|
|
||||||
|
let param: any = await schema.validateAsync(req.params);
|
||||||
|
|
||||||
|
let data = await CardTypeModel.list({ "id": param.id }).then((q) => q.getOne());
|
||||||
|
if (!data) throw { message: "CardType Not Found" };
|
||||||
|
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_view, data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_not_found, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
369
src/controllers/payment-method.ts
Normal file
369
src/controllers/payment-method.ts
Normal file
@ -0,0 +1,369 @@
|
|||||||
|
import { Response, NextFunction, Application } from "express";
|
||||||
|
import { Request } from "express-jwt";
|
||||||
|
import { ReturnHelper } from "../helpers/express/return";
|
||||||
|
import { OrmHelper } from "../helpers/orm";
|
||||||
|
import Joi from "joi";
|
||||||
|
import { ILogObj, Logger } from "tslog";
|
||||||
|
import { Language } from "../langs/lang";
|
||||||
|
import { Paging, PaymentMethod } from "entity";
|
||||||
|
import CommonHelper from "../helpers/common";
|
||||||
|
import * as fastcsv from 'fast-csv';
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { PaymentMethodModel } from "../model/payment_method";
|
||||||
|
|
||||||
|
const log: Logger<ILogObj> = new Logger({ name: '[PaymentMethodController]', type: 'pretty' });
|
||||||
|
|
||||||
|
export class PaymentMethodController {
|
||||||
|
static async list(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['PaymentMethod']
|
||||||
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
#swagger.parameters['filter'] = { description: '', in: 'query', type: 'string' }
|
||||||
|
#swagger.parameters['limit'] = { in: 'query', required: true, type: 'number' }
|
||||||
|
#swagger.parameters['page'] = { in: 'query', required: true, type: 'number' }
|
||||||
|
#swagger.parameters['with_deleted'] = { in: 'query', required: true, type: 'boolean' }
|
||||||
|
#swagger.parameters['order_field'] = { in: 'query', required: true, type: 'string' }
|
||||||
|
#swagger.parameters['order_direction'] = { in: 'query', required: true, schema: { '@enum': ['ASC', 'DESC'] } }
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
filter: Joi.string().allow("").optional().label("Filter"),
|
||||||
|
page: Joi.number().required().min(1).label("Page"),
|
||||||
|
limit: Joi.number().required().min(1).label("Limit"),
|
||||||
|
with_deleted: Joi.bool().required().label("With Deleted"),
|
||||||
|
order_field: Joi.string().required().label("Order Field"),
|
||||||
|
order_direction: Joi.string().allow("asc", "desc").required().label("Order Direction"),
|
||||||
|
});
|
||||||
|
|
||||||
|
let param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|
||||||
|
let filter = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
|
||||||
|
let filterAny = filter.any && filter.any !== "" ? filter.any : "";
|
||||||
|
|
||||||
|
let filterObj = { ...filter } as any;
|
||||||
|
delete filterObj.any;
|
||||||
|
filterObj = { ...filterObj };
|
||||||
|
|
||||||
|
var query = await PaymentMethodModel.list(filterObj, filterAny);
|
||||||
|
|
||||||
|
const offset = (param.page - 1) * param.limit;
|
||||||
|
let limit = param.limit;
|
||||||
|
|
||||||
|
const res_count = query;
|
||||||
|
const res_list = query
|
||||||
|
.orderBy("payment_method." + param.order_field, param.order_direction)
|
||||||
|
.offset(offset)
|
||||||
|
.limit(limit);
|
||||||
|
|
||||||
|
if (param.with_deleted) {
|
||||||
|
res_count.withDeleted();
|
||||||
|
res_list.withDeleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
const current_page = param.page;
|
||||||
|
const total_count_data = await res_count.getCount();
|
||||||
|
const list_data = await res_list.getMany();
|
||||||
|
const count_data = CommonHelper.countObject(list_data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponselist(res, 200, Language.lang.success_view, count_data, current_page, total_count_data, list_data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['PaymentMethod']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['filter'] = {
|
||||||
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
|
in: 'query',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['filter'] = {
|
||||||
|
in: 'query',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['order_field'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['order_direction'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
schema: {
|
||||||
|
'@enum': ['ASC', 'DESC']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|
||||||
|
let filter = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
|
||||||
|
|
||||||
|
var query = await PaymentMethodModel.list(filter);
|
||||||
|
const data = await query.getMany();
|
||||||
|
|
||||||
|
const filename = "payment_method.csv";
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'text/csv');
|
||||||
|
res.setHeader('Content-Disposition', 'attachment; filename=' + filename);
|
||||||
|
|
||||||
|
const csvStream = fastcsv.format({
|
||||||
|
headers: true,
|
||||||
|
writeHeaders: true,
|
||||||
|
transform: (row: PaymentMethod): any => ({
|
||||||
|
...row,
|
||||||
|
created_at: dayjs(row.created_at).format('DD-MM-YYYY HH:MM:ss'),
|
||||||
|
})
|
||||||
|
});
|
||||||
|
csvStream.pipe(res);
|
||||||
|
|
||||||
|
const limit = 50;
|
||||||
|
|
||||||
|
const fetchAndWrite = async (page: any) => {
|
||||||
|
|
||||||
|
if (CommonHelper.countObject(data) === 0) {
|
||||||
|
csvStream.end();
|
||||||
|
} else {
|
||||||
|
data.forEach((item: any) => csvStream.write(item));
|
||||||
|
|
||||||
|
if (CommonHelper.countObject(data) == limit) {
|
||||||
|
fetchAndWrite(page + 1);
|
||||||
|
} else {
|
||||||
|
csvStream.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchAndWrite(1);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async create(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['PaymentMethod']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
|
||||||
|
#swagger.requestBody = {
|
||||||
|
required: true,
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: {
|
||||||
|
$ref: "#/components/schemas/payment_method"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
name: Joi.string().max(256).required().label('Name'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: any = await schema.validateAsync(req.body);
|
||||||
|
|
||||||
|
const data = new PaymentMethod()
|
||||||
|
data.name = param.name;
|
||||||
|
data.created_by = req.auth.data.name;
|
||||||
|
data.updated_by = req.auth.data.name;
|
||||||
|
|
||||||
|
await OrmHelper.DB.manager.save(data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_insert, data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 401, Language.lang.failed_insert, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async update(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['PaymentMethod']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'PaymentMethod ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
|
||||||
|
#swagger.requestBody = {
|
||||||
|
required: true,
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: {
|
||||||
|
$ref: "#/components/schemas/payment_method"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID'),
|
||||||
|
name: Joi.string().max(256).required().label('Name'),
|
||||||
|
});
|
||||||
|
|
||||||
|
req.body.id = req.params['id'];
|
||||||
|
|
||||||
|
const param: any = await schema.validateAsync(req.body);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(PaymentMethod);
|
||||||
|
|
||||||
|
const data = await repo.findOneBy({ id: param.id });
|
||||||
|
|
||||||
|
if (data != null) {
|
||||||
|
data.name = param.name;
|
||||||
|
data.updated_by = req.auth.data.name;
|
||||||
|
|
||||||
|
await repo.save(data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_update, data);
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_update, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async delete(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['PaymentMethod']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'PaymentMethod ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['hard'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'Is Hard Delete',
|
||||||
|
required: false,
|
||||||
|
type: 'boolean'
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID'),
|
||||||
|
hard: Joi.bool().optional().allow('').label('Is hard delete?')
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: { id: string, hard: boolean } = await schema.validateAsync(req.params);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(PaymentMethod);
|
||||||
|
|
||||||
|
const existData = await repo.findOne({ where: { id: param.id } });
|
||||||
|
if (existData && !param.hard) {
|
||||||
|
existData.deleted_by = req.auth.data.name;
|
||||||
|
await OrmHelper.DB.manager.save(existData);
|
||||||
|
}
|
||||||
|
|
||||||
|
const affected = (!param.hard ? await repo.softDelete({ id: param.id }) : await repo.delete({ id: param.id })).affected;
|
||||||
|
|
||||||
|
if (affected > 0) {
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_delete, {});
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_delete, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async restore(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['PaymentMethod']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'PaymentMethod ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID')
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: any = await schema.validateAsync(req.params);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(PaymentMethod);
|
||||||
|
|
||||||
|
const affected = (await repo.restore({ id: param.id })).affected;
|
||||||
|
|
||||||
|
if (affected > 0) {
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_restore, {});
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_restore, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async detail(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['PaymentMethod']
|
||||||
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
#swagger.parameters['id'] = { description: '', in: 'path', type: 'string' }
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label("PaymentMethod Id"),
|
||||||
|
});
|
||||||
|
|
||||||
|
let param: any = await schema.validateAsync(req.params);
|
||||||
|
|
||||||
|
let data = await PaymentMethodModel.list({ "id": param.id }).then((q) => q.getOne());
|
||||||
|
if (!data) throw { message: "PaymentMethod Not Found" };
|
||||||
|
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_view, data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_not_found, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { DataSource } from "typeorm";
|
import { DataSource } from "typeorm";
|
||||||
import { ILogObj, Logger } from 'tslog';
|
import { ILogObj, Logger } from 'tslog';
|
||||||
import { FareType,RoomStock,Administrativu, Aldeia, District, Menu, Munisipo, Suco, Application, Nationality, Diagnosis, DiagnosticProcedure, Room, ServiceType, ServiceClass, Service, ServiceFare, ServicePackage, Department, DoctorSchedule, MeasurementUnit, ReferenceRange, QueueMonitoring, ExaminationDetail, ExaminationType, User, UserRole, HrmsEmployee, HrmsDepartment, HrmsPosition, HrmsShift, HospitalInformation, ItemOrigin, ItemType, ItemTypeDetail, Unit, ItemCategory, ItemStatus, UsageInstructions, UsageTime, ItemClass, ItemClassDetail, GenericName, Factory, Supplier, FactoryToSupplier, ItemMaster, ItemGroup, PharmacyInfo, ItemPrice, SellingPricePercentage, PatientGroup, PatientGuarantor, InitialStock, DoctorItem, DoctorItemPackage, UserToRoom, RoomToPharmacy, PlanningVerificator, ScheduleSeries, ScheduleException } from 'entity'
|
import { FareType, RoomStock, Administrativu, Aldeia, District, Menu, Munisipo, Suco, Application, Nationality, Diagnosis, DiagnosticProcedure, Room, ServiceType, ServiceClass, Service, ServiceFare, ServicePackage, Department, DoctorSchedule, MeasurementUnit, ReferenceRange, QueueMonitoring, ExaminationDetail, ExaminationType, User, UserRole, HrmsEmployee, HrmsDepartment, HrmsPosition, HrmsShift, HospitalInformation, ItemOrigin, ItemType, ItemTypeDetail, Unit, ItemCategory, ItemStatus, UsageInstructions, UsageTime, ItemClass, ItemClassDetail, GenericName, Factory, Supplier, FactoryToSupplier, ItemMaster, ItemGroup, PharmacyInfo, ItemPrice, SellingPricePercentage, PatientGroup, PatientGuarantor, InitialStock, DoctorItem, DoctorItemPackage, UserToRoom, RoomToPharmacy, PlanningVerificator, ScheduleSeries, ScheduleException, CardType, PaymentMethod } from 'entity'
|
||||||
|
|
||||||
export class OrmHelper {
|
export class OrmHelper {
|
||||||
static DB: DataSource = null
|
static DB: DataSource = null
|
||||||
@ -48,9 +48,11 @@ export class OrmHelper {
|
|||||||
RoomToPharmacy,
|
RoomToPharmacy,
|
||||||
PlanningVerificator,
|
PlanningVerificator,
|
||||||
RoomStock,
|
RoomStock,
|
||||||
ScheduleSeries,
|
ScheduleSeries,
|
||||||
ScheduleException,
|
ScheduleException,
|
||||||
FareType
|
FareType,
|
||||||
|
CardType,
|
||||||
|
PaymentMethod
|
||||||
],
|
],
|
||||||
subscribers: [],
|
subscribers: [],
|
||||||
migrations: [],
|
migrations: [],
|
||||||
|
|||||||
37
src/model/card_type.ts
Normal file
37
src/model/card_type.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { SelectQueryBuilder } from "typeorm";
|
||||||
|
import CommonHelper from "../helpers/common";
|
||||||
|
import { OrmHelper } from "../helpers/orm";
|
||||||
|
import { CardType } from "entity";
|
||||||
|
|
||||||
|
export class CardTypeModel {
|
||||||
|
static async list(filterObj = {}, filterAny: string = ""): Promise<SelectQueryBuilder<any>> {
|
||||||
|
const repo = OrmHelper.DB.getRepository(CardType);
|
||||||
|
let whereAttr = [];
|
||||||
|
let whereVal: any = {};
|
||||||
|
if (filterObj) {
|
||||||
|
const filterResult = CommonHelper.handleQueryFilter(filterObj);
|
||||||
|
whereAttr = [...whereAttr, ...filterResult.whereAttr];
|
||||||
|
whereVal = { ...whereVal, ...filterResult.whereVal };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterAny && filterAny !== "" && filterAny !== null && filterAny !== undefined) {
|
||||||
|
const filterResult = CommonHelper.handleFilter({
|
||||||
|
filter: JSON.stringify({ any: filterAny }),
|
||||||
|
col_any_eq: [],
|
||||||
|
col_any_like: ["name"],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (filterResult.whereAttr && filterResult.whereAttr !== "") {
|
||||||
|
whereAttr = [...whereAttr, filterResult.whereAttr];
|
||||||
|
whereVal = { ...whereVal, ...filterResult.whereVal };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var query = repo.createQueryBuilder("card_type");
|
||||||
|
if (whereAttr.length != 0) {
|
||||||
|
query = query.where(whereAttr.join(" and "), whereVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
}
|
||||||
37
src/model/payment_method.ts
Normal file
37
src/model/payment_method.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { SelectQueryBuilder } from "typeorm";
|
||||||
|
import CommonHelper from "../helpers/common";
|
||||||
|
import { OrmHelper } from "../helpers/orm";
|
||||||
|
import { PaymentMethod } from "entity";
|
||||||
|
|
||||||
|
export class PaymentMethodModel {
|
||||||
|
static async list(filterObj = {}, filterAny: string = ""): Promise<SelectQueryBuilder<any>> {
|
||||||
|
const repo = OrmHelper.DB.getRepository(PaymentMethod);
|
||||||
|
let whereAttr = [];
|
||||||
|
let whereVal: any = {};
|
||||||
|
if (filterObj) {
|
||||||
|
const filterResult = CommonHelper.handleQueryFilter(filterObj);
|
||||||
|
whereAttr = [...whereAttr, ...filterResult.whereAttr];
|
||||||
|
whereVal = { ...whereVal, ...filterResult.whereVal };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterAny && filterAny !== "" && filterAny !== null && filterAny !== undefined) {
|
||||||
|
const filterResult = CommonHelper.handleFilter({
|
||||||
|
filter: JSON.stringify({ any: filterAny }),
|
||||||
|
col_any_eq: [],
|
||||||
|
col_any_like: ["name"],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (filterResult.whereAttr && filterResult.whereAttr !== "") {
|
||||||
|
whereAttr = [...whereAttr, filterResult.whereAttr];
|
||||||
|
whereVal = { ...whereVal, ...filterResult.whereVal };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var query = repo.createQueryBuilder("payment_method");
|
||||||
|
if (whereAttr.length != 0) {
|
||||||
|
query = query.where(whereAttr.join(" and "), whereVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -60,6 +60,8 @@ import { RoomToPharmacyController } from '../controllers/room_to_pharmacy';
|
|||||||
import { PlanningVerificatorController } from '../controllers/pharmacy/planning_verificator';
|
import { PlanningVerificatorController } from '../controllers/pharmacy/planning_verificator';
|
||||||
import { ScheduleController } from '../controllers/schedule';
|
import { ScheduleController } from '../controllers/schedule';
|
||||||
import { FareTypeController } from '../controllers/faretype';
|
import { FareTypeController } from '../controllers/faretype';
|
||||||
|
import { CardTypeController } from '../controllers/card_type';
|
||||||
|
import { PaymentMethodController } from '../controllers/payment-method';
|
||||||
|
|
||||||
export class RoutePrivate {
|
export class RoutePrivate {
|
||||||
static setup(app: express.Application) {
|
static setup(app: express.Application) {
|
||||||
@ -457,5 +459,19 @@ export class RoutePrivate {
|
|||||||
app.put('/api/fare-type/update/:id', FareTypeController.update)
|
app.put('/api/fare-type/update/:id', FareTypeController.update)
|
||||||
app.delete('/api/fare-type/delete/:id/:hard', FareTypeController.delete)
|
app.delete('/api/fare-type/delete/:id/:hard', FareTypeController.delete)
|
||||||
app.put('/api/fare-type/restore/:id', FareTypeController.restore)
|
app.put('/api/fare-type/restore/:id', FareTypeController.restore)
|
||||||
|
|
||||||
|
app.get('/api/card-type/list', CardTypeController.list)
|
||||||
|
app.post('/api/card-type/create', CardTypeController.create)
|
||||||
|
app.get('/api/card-type/detail/:id', CardTypeController.detail)
|
||||||
|
app.put('/api/card-type/update/:id', CardTypeController.update)
|
||||||
|
app.delete('/api/card-type/delete/:id/:hard', CardTypeController.delete)
|
||||||
|
app.put('/api/card-type/restore/:id', CardTypeController.restore)
|
||||||
|
|
||||||
|
app.get('/api/payment-method/list', PaymentMethodController.list)
|
||||||
|
app.post('/api/payment-method/create', PaymentMethodController.create)
|
||||||
|
app.get('/api/payment-method/detail/:id', PaymentMethodController.detail)
|
||||||
|
app.put('/api/payment-method/update/:id', PaymentMethodController.update)
|
||||||
|
app.delete('/api/payment-method/delete/:id/:hard', PaymentMethodController.delete)
|
||||||
|
app.put('/api/payment-method/restore/:id', PaymentMethodController.restore)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,460 +1,463 @@
|
|||||||
const swaggerAutogen = require('swagger-autogen')({ openapi: '3.0.0' });
|
const swaggerAutogen = require("swagger-autogen")({ openapi: "3.0.0" });
|
||||||
const config = require('config');
|
const config = require("config");
|
||||||
|
|
||||||
const doc = {
|
const doc = {
|
||||||
info: {
|
info: {
|
||||||
title: config.get('app.name'),
|
title: config.get("app.name"),
|
||||||
description: config.get('app.description'),
|
description: config.get("app.description"),
|
||||||
version: config.get('app.version')
|
version: config.get("app.version"),
|
||||||
|
},
|
||||||
|
servers: [
|
||||||
|
{
|
||||||
|
url: config.get("server.host_swagger"),
|
||||||
|
description: "Environtment " + config.get("app.env"),
|
||||||
},
|
},
|
||||||
servers: [
|
],
|
||||||
{
|
components: {
|
||||||
url: config.get('server.host_swagger'),
|
schemas: {
|
||||||
description: 'Environtment ' + config.get('app.env')
|
product: {
|
||||||
},
|
$code: "123456",
|
||||||
],
|
$name: "Product name",
|
||||||
components: {
|
$description: "Product description",
|
||||||
schemas: {
|
$source: "trialBalanceBranch / cifAccount / lnkolek",
|
||||||
product: {
|
$status: "Y",
|
||||||
$code: "123456",
|
},
|
||||||
$name: "Product name",
|
branch: {
|
||||||
$description: "Product description",
|
$code: "123456",
|
||||||
$source: "trialBalanceBranch / cifAccount / lnkolek",
|
$name: "Branch name",
|
||||||
$status: "Y",
|
$status: "Y",
|
||||||
},
|
},
|
||||||
branch: {
|
menu: {
|
||||||
$code: "123456",
|
$module: "Dashboard",
|
||||||
$name: "Branch name",
|
$name: "Dashboard",
|
||||||
$status: "Y",
|
$link: "/",
|
||||||
},
|
$id_parent: "",
|
||||||
menu: {
|
$order_number: 1,
|
||||||
$module: "Dashboard",
|
$icon: "",
|
||||||
$name: "Dashboard",
|
$application: "ukln",
|
||||||
$link: "/",
|
$status: "Y",
|
||||||
$id_parent: "",
|
},
|
||||||
$order_number: 1,
|
administrativu: {
|
||||||
$icon: "",
|
$code: "123456",
|
||||||
$application: "ukln",
|
$name: "Administrativu name",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
$munisipo_id: "uuid-string",
|
||||||
administrativu: {
|
},
|
||||||
$code: '123456',
|
application: {
|
||||||
$name: 'Administrativu name',
|
$id: "ukln",
|
||||||
$status: "Y",
|
$name: "Dashboard Performance Business",
|
||||||
$munisipo_id: "uuid-string"
|
$reset_password_url: "https://brilianapps.britimorleste.tl/ukln/auth/reset-password/",
|
||||||
},
|
$status: "Y",
|
||||||
application: {
|
},
|
||||||
$id: 'ukln',
|
aldeia: {
|
||||||
$name: 'Dashboard Performance Business',
|
$code: "123456",
|
||||||
$reset_password_url: 'https://brilianapps.britimorleste.tl/ukln/auth/reset-password/',
|
$name: "Aldeia name",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
$suco_id: "uuid-string",
|
||||||
aldeia: {
|
},
|
||||||
$code: '123456',
|
class_economi: {
|
||||||
$name: 'Aldeia name',
|
$code: "123456",
|
||||||
$status: "Y",
|
$name: "Class economi name",
|
||||||
$suco_id: "uuid-string"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
class_economi: {
|
district: {
|
||||||
$code: '123456',
|
$code: "123456",
|
||||||
$name: 'Class economi name',
|
$name: "District name",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
district: {
|
income_tier: {
|
||||||
$code: '123456',
|
$code: "123456",
|
||||||
$name: 'District name',
|
$name: "Income tier name",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
income_tier: {
|
munisipo: {
|
||||||
$code: '123456',
|
$code: "123456",
|
||||||
$name: 'Income tier name',
|
$name: "Munisipo name",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
munisipo: {
|
suco: {
|
||||||
$code: '123456',
|
$code: "123456",
|
||||||
$name: 'Munisipo name',
|
$name: "Suco name",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
$administrativu_id: "uuid-string",
|
||||||
suco: {
|
},
|
||||||
$code: '123456',
|
nationality: {
|
||||||
$name: 'Suco name',
|
$code: "123456",
|
||||||
$status: "Y",
|
$name: "Nationality name",
|
||||||
$administrativu_id: "uuid-string"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
nationality: {
|
classEconomi: {
|
||||||
$code: '123456',
|
$code: "123456",
|
||||||
$name: 'Nationality name',
|
$name: "Class Economi name",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
classEconomi: {
|
incomeTier: {
|
||||||
$code: '123456',
|
$code: "123456",
|
||||||
$name: 'Class Economi name',
|
$name: "Income Tier name",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
incomeTier: {
|
diagnosis: {
|
||||||
$code: '123456',
|
$diagnosis: "Diagnosis name (ICD-11)",
|
||||||
$name: 'Income Tier name',
|
$code: "ABC123",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
diagnosis: {
|
diagnostic_procedure: {
|
||||||
$diagnosis: "Diagnosis name (ICD-11)",
|
$diagnosticProcedure: "Procedure name (ICD-9)",
|
||||||
$code: "ABC123",
|
$code: "XYZ789",
|
||||||
$status: "Y"
|
$status: "Y",
|
||||||
},
|
},
|
||||||
diagnostic_procedure: {
|
room: {
|
||||||
$diagnosticProcedure: "Procedure name (ICD-9)",
|
$room: "Room name",
|
||||||
$code: "XYZ789",
|
$code: "R001",
|
||||||
$status: "Y"
|
$description: "Optional description",
|
||||||
},
|
$department_id: "uuid-string",
|
||||||
room: {
|
$status: "Y",
|
||||||
$room: "Room name",
|
$location: "Room location",
|
||||||
$code: "R001",
|
$picture: "Room picture name",
|
||||||
$description: "Optional description",
|
},
|
||||||
$department_id: "uuid-string",
|
laboratory: {
|
||||||
$status: "Y",
|
$room: "Room name",
|
||||||
$location: "Room location",
|
$code: "R001",
|
||||||
$picture: "Room picture name"
|
$description: "Optional description",
|
||||||
},
|
$department_id: "uuid-string",
|
||||||
laboratory: {
|
$status: "Y",
|
||||||
$room: "Room name",
|
},
|
||||||
$code: "R001",
|
// pharmacy: {
|
||||||
$description: "Optional description",
|
// $room: "Room name",
|
||||||
$department_id: "uuid-string",
|
// $code: "R001",
|
||||||
$status: "Y"
|
// $description: "Optional description",
|
||||||
},
|
// $department_id: "uuid-string",
|
||||||
// pharmacy: {
|
// $status: "Y"
|
||||||
// $room: "Room name",
|
// },
|
||||||
// $code: "R001",
|
serviceType: {
|
||||||
// $description: "Optional description",
|
$name: "Registration & Tickets",
|
||||||
// $department_id: "uuid-string",
|
$status: { "@enum": ["Y", "N"] },
|
||||||
// $status: "Y"
|
},
|
||||||
// },
|
serviceClass: {
|
||||||
serviceType: {
|
$name: "Class name",
|
||||||
$name: "Registration & Tickets",
|
},
|
||||||
$status: { "@enum": ["Y", "N"] }
|
service: {
|
||||||
},
|
$name: "e.g. ER Registration",
|
||||||
serviceClass: {
|
$service_type_id: "uuid-string",
|
||||||
$name: "Class name"
|
$status: { "@enum": ["Y", "N"] },
|
||||||
},
|
},
|
||||||
service: {
|
roomServices: {
|
||||||
$name: "e.g. ER Registration",
|
$service_ids: ["uuid-string"],
|
||||||
$service_type_id: "uuid-string",
|
},
|
||||||
$status: { "@enum": ["Y", "N"] }
|
serviceFare: {
|
||||||
},
|
$service_class_id: "uuid-string",
|
||||||
roomServices: {
|
$service_id: "uuid-string",
|
||||||
$service_ids: ["uuid-string"]
|
$faretype: "uuid-string",
|
||||||
},
|
$fare: 100000,
|
||||||
serviceFare: {
|
},
|
||||||
$service_class_id: "uuid-string",
|
servicePackage: {
|
||||||
$service_id: "uuid-string",
|
$name: "Package name",
|
||||||
$faretype: "uuid-string",
|
$service_class_id: "uuid-string",
|
||||||
$fare: 100000
|
$fare: 500000,
|
||||||
},
|
$service_ids: ["uuid-string"],
|
||||||
servicePackage: {
|
},
|
||||||
$name: "Package name",
|
department: {
|
||||||
$service_class_id: "uuid-string",
|
$name: "igd",
|
||||||
$fare: 500000,
|
$status: { "@enum": ["Y", "N"] },
|
||||||
$service_ids: ["uuid-string"]
|
},
|
||||||
},
|
doctorSchedule: {
|
||||||
department: {
|
$day: "Senin",
|
||||||
$name: "igd",
|
$start_time: "08:00",
|
||||||
$status: { "@enum": ["Y", "N"] }
|
$end_time: "12:00",
|
||||||
},
|
$doctor_id: "uuid-string",
|
||||||
doctorSchedule: {
|
$room_id: "uuid-string",
|
||||||
$day: "Senin",
|
$quota: "20",
|
||||||
$start_time: "08:00",
|
$status: { "@enum": ["Y", "N"] },
|
||||||
$end_time: "12:00",
|
},
|
||||||
$doctor_id: "uuid-string",
|
doctorItem: {
|
||||||
$room_id: "uuid-string",
|
$doctor_id: "uuid-string",
|
||||||
$quota: "20",
|
$item_master_id: "uuid-string",
|
||||||
$status: { "@enum": ["Y", "N"] }
|
},
|
||||||
},
|
doctorItemPackage: {
|
||||||
doctorItem: {
|
$doctor_id: "uuid-string",
|
||||||
$doctor_id: "uuid-string",
|
$name: "Paket Obat Harian",
|
||||||
$item_master_id: "uuid-string"
|
$description: "Optional description",
|
||||||
},
|
$item_master_ids: ["uuid-string"],
|
||||||
doctorItemPackage: {
|
$active: true,
|
||||||
$doctor_id: "uuid-string",
|
},
|
||||||
$name: "Paket Obat Harian",
|
measurementUnit: {
|
||||||
$description: "Optional description",
|
$unit: "Milligram",
|
||||||
$item_master_ids: ["uuid-string"],
|
$status: { "@enum": ["Y", "N"] },
|
||||||
$active: true
|
},
|
||||||
},
|
referenceRange: {
|
||||||
measurementUnit: {
|
$gender: { "@enum": ["male", "female"] },
|
||||||
$unit: "Milligram",
|
$age_range_min: "0 | (days)",
|
||||||
$status: { "@enum": ["Y", "N"] }
|
$age_range_max: "20 | (days)",
|
||||||
},
|
$value_min: "13.7",
|
||||||
referenceRange: {
|
$value_max: "17.5",
|
||||||
$gender: { "@enum": ["male", "female"] },
|
$status: { "@enum": ["Y", "N"] },
|
||||||
$age_range_min: "0 | (days)",
|
},
|
||||||
$age_range_max: "20 | (days)",
|
queueMonitoring: {
|
||||||
$value_min: "13.7",
|
$name: "Ground Floor Queue",
|
||||||
$value_max: "17.5",
|
$slug: "ground-floor-queue",
|
||||||
$status: { "@enum": ["Y", "N"] }
|
$room_ids: ["uuid-string"],
|
||||||
},
|
$status: { "@enum": ["Y", "N"] },
|
||||||
queueMonitoring: {
|
},
|
||||||
$name: "Ground Floor Queue",
|
examinationType: {
|
||||||
$slug: "ground-floor-queue",
|
$name: "Examination Type name",
|
||||||
$room_ids: ["uuid-string"],
|
$status: { "@enum": ["Y", "N"] },
|
||||||
$status: { "@enum": ["Y", "N"] }
|
$service_ids: ["uuid-string"],
|
||||||
},
|
},
|
||||||
examinationType: {
|
examinationDetail: {
|
||||||
$name: "Examination Type name",
|
$name: "Examination Detail name",
|
||||||
$status: { "@enum": ["Y", "N"] },
|
$order_no: "Order number",
|
||||||
$service_ids: ["uuid-string"]
|
$measurement_unit_id: "uuid-string",
|
||||||
},
|
$reference_range_id: "uuid-string",
|
||||||
examinationDetail: {
|
$status: { "@enum": ["Y", "N"] },
|
||||||
$name: "Examination Detail name",
|
},
|
||||||
$order_no: "Order number",
|
serviceExamination: {
|
||||||
$measurement_unit_id: "uuid-string",
|
$examination_detail_ids: ["uuid-string"],
|
||||||
$reference_range_id: "uuid-string",
|
},
|
||||||
$status: { "@enum": ["Y", "N"] }
|
hospitalinformation: {
|
||||||
},
|
$name: "Hospital Name",
|
||||||
serviceExamination: {
|
$address: "Hospital Address",
|
||||||
$examination_detail_ids: ["uuid-string"]
|
$phone: "Hospital Phone",
|
||||||
},
|
$logo: "Hospital Logo",
|
||||||
hospitalinformation: {
|
},
|
||||||
$name: "Hospital Name",
|
files: {
|
||||||
$address: "Hospital Address",
|
$file_name: "File Name",
|
||||||
$phone: "Hospital Phone",
|
},
|
||||||
$logo: "Hospital Logo",
|
item_group: {
|
||||||
},
|
$group_name: "ItemGroup name",
|
||||||
files: {
|
},
|
||||||
$file_name: "File Name",
|
item_origin: {
|
||||||
},
|
$origin_name: "ItemOrigin name",
|
||||||
item_group: {
|
$origin_description: "ItemOrigin Desc",
|
||||||
$group_name: 'ItemGroup name',
|
$department: "Department name",
|
||||||
},
|
$account: "Account name",
|
||||||
item_origin: {
|
},
|
||||||
$origin_name: 'ItemOrigin name',
|
item_type: {
|
||||||
$origin_description: 'ItemOrigin Desc',
|
$type_name: "ItemType name",
|
||||||
$department: 'Department name',
|
$item_group_id: "ItemGroup Id",
|
||||||
$account: 'Account name',
|
},
|
||||||
},
|
item_type_detail: {
|
||||||
item_type: {
|
$type_detail_name: "ItemTypeDetail name",
|
||||||
$type_name: 'ItemType name',
|
$item_type_id: "ItemType Id",
|
||||||
$item_group_id: 'ItemGroup Id'
|
},
|
||||||
},
|
unit: {
|
||||||
item_type_detail: {
|
$unit_name: "Unit name",
|
||||||
$type_detail_name: 'ItemTypeDetail name',
|
$small_unit: "Small unit name",
|
||||||
$item_type_id: 'ItemType Id'
|
$large_unit: "Large unit name",
|
||||||
},
|
},
|
||||||
unit: {
|
item_category: {
|
||||||
$unit_name: 'Unit name',
|
$category_name: "ItemCategory name",
|
||||||
$small_unit: 'Small unit name',
|
},
|
||||||
$large_unit: 'Large unit name'
|
item_status: {
|
||||||
},
|
$status_name: "Itemstatus name",
|
||||||
item_category: {
|
},
|
||||||
$category_name: 'ItemCategory name',
|
item_class: {
|
||||||
},
|
$item_class_name: "ItemClass name",
|
||||||
item_status: {
|
},
|
||||||
$status_name: 'Itemstatus name',
|
item_class_detail: {
|
||||||
},
|
$class_detail_name: "ItemClassDetail name",
|
||||||
item_class: {
|
},
|
||||||
$item_class_name: 'ItemClass name',
|
usage_instructions: {
|
||||||
},
|
$usage_instructions_name: "UsageInstructions name",
|
||||||
item_class_detail: {
|
$usage_instructions_abbreviation: "UsageInstructions Abbreviation",
|
||||||
$class_detail_name: 'ItemClassDetail name',
|
},
|
||||||
},
|
usage_time: {
|
||||||
usage_instructions: {
|
$usage_time_name: "UsageInstructions name",
|
||||||
$usage_instructions_name: 'UsageInstructions name',
|
$usage_time_abbreviation: "UsageInstructions Abbreviation",
|
||||||
$usage_instructions_abbreviation: 'UsageInstructions Abbreviation'
|
},
|
||||||
},
|
generic_name: {
|
||||||
usage_time: {
|
$generic_name: "Generic name",
|
||||||
$usage_time_name: 'UsageInstructions name',
|
},
|
||||||
$usage_time_abbreviation: 'UsageInstructions Abbreviation'
|
factory: {
|
||||||
},
|
$factory_name: "factory name",
|
||||||
generic_name: {
|
$address: "Factory address",
|
||||||
$generic_name: 'Generic name',
|
$web: "Factory url web",
|
||||||
},
|
$phone: "Factory phone",
|
||||||
factory: {
|
$email: "Factory email",
|
||||||
$factory_name: 'factory name',
|
},
|
||||||
$address: 'Factory address',
|
supplier: {
|
||||||
$web: 'Factory url web',
|
$supplier_name: "supplier name",
|
||||||
$phone: 'Factory phone',
|
$address: "supplier address",
|
||||||
$email: 'Factory email'
|
$phone: "supplier phone",
|
||||||
},
|
$email: "supplier email",
|
||||||
supplier: {
|
},
|
||||||
$supplier_name: 'supplier name',
|
factory_to_supplier: {
|
||||||
$address: 'supplier address',
|
$supplier_id: "Supplier ID (required, UUID)",
|
||||||
$phone: 'supplier phone',
|
$factory_ids: "Array [factory-uuid-1, factory-uuid-2]",
|
||||||
$email: 'supplier email'
|
},
|
||||||
},
|
item_master: {
|
||||||
factory_to_supplier: {
|
$item_name: "Item name",
|
||||||
$supplier_id: 'Supplier ID (required, UUID)',
|
$generic_name_id: "Generic name ID (UUID)",
|
||||||
$factory_ids: 'Array [factory-uuid-1, factory-uuid-2]'
|
$item_type_detail_id: "Item type detail ID (UUID)",
|
||||||
},
|
$item_category_id: "Item category ID (UUID)",
|
||||||
item_master: {
|
$item_class_id: "Item class ID (UUID)",
|
||||||
$item_name: 'Item name',
|
$item_class_detail_id: "Item class Detail ID (UUID)",
|
||||||
$generic_name_id: 'Generic name ID (UUID)',
|
$item_status_id: "Item status ID (UUID)",
|
||||||
$item_type_detail_id: 'Item type detail ID (UUID)',
|
$factory_id: "Factory ID (UUID)",
|
||||||
$item_category_id: 'Item category ID (UUID)',
|
$unit_id: "Unit ID (UUID)",
|
||||||
$item_class_id: 'Item class ID (UUID)',
|
$pack_size: "Pack size (integer, minimum 0)",
|
||||||
$item_class_detail_id: 'Item class Detail ID (UUID)',
|
$minimum_quantity: "Minimum quantity (integer, minimum 0)",
|
||||||
$item_status_id: 'Item status ID (UUID)',
|
$minimum_sales_quantity: "Minimum sales quantity (integer, minimum 0)",
|
||||||
$factory_id: 'Factory ID (UUID)',
|
$strength: "Strength value (number, minimum 0)",
|
||||||
$unit_id: 'Unit ID (UUID)',
|
$active: "Active status (boolean)",
|
||||||
$pack_size: 'Pack size (integer, minimum 0)',
|
},
|
||||||
$minimum_quantity: 'Minimum quantity (integer, minimum 0)',
|
pharmacy_info: {
|
||||||
$minimum_sales_quantity: 'Minimum sales quantity (integer, minimum 0)',
|
$logo: "Logo (string, max 256)",
|
||||||
$strength: 'Strength value (number, minimum 0)',
|
$name: "Name (string, max 256)",
|
||||||
$active: 'Active status (boolean)'
|
$address: "Address (string, max 500)",
|
||||||
},
|
$munisipiu: "Munisipiu ID (UUID)",
|
||||||
pharmacy_info: {
|
$postu_admin: "Postu Admin ID (UUID)",
|
||||||
$logo: 'Logo (string, max 256)',
|
$suco: "Suco ID (UUID)",
|
||||||
$name: 'Name (string, max 256)',
|
$aldeia: "Aldeia ID (UUID)",
|
||||||
$address: 'Address (string, max 500)',
|
$phone: "Phone (string, max 30, optional)",
|
||||||
$munisipiu: 'Munisipiu ID (UUID)',
|
$default_room_id: "Default Room ID (UUID)",
|
||||||
$postu_admin: 'Postu Admin ID (UUID)',
|
},
|
||||||
$suco: 'Suco ID (UUID)',
|
item_price: {
|
||||||
$aldeia: 'Aldeia ID (UUID)',
|
$item_master_id: "Item Master ID (required, UUID)",
|
||||||
$phone: 'Phone (string, max 30, optional)',
|
$purchase_price: "Purchase Price (required, number, minimum 0)",
|
||||||
$default_room_id: 'Default Room ID (UUID)'
|
$selling_price: "Selling Price (required, number, minimum 0)",
|
||||||
},
|
$expired_date: "Expired Date (required, date)",
|
||||||
item_price: {
|
},
|
||||||
$item_master_id: 'Item Master ID (required, UUID)',
|
initial_stock: {
|
||||||
$purchase_price: 'Purchase Price (required, number, minimum 0)',
|
$itemmaster: "Item Master uuid",
|
||||||
$selling_price: 'Selling Price (required, number, minimum 0)',
|
$room: "Room uuid",
|
||||||
$expired_date: 'Expired Date (required, date)'
|
$itemorigin: "Item Origin uuid",
|
||||||
},
|
$batch: "Batch",
|
||||||
initial_stock: {
|
$exp_date: "Exp Date",
|
||||||
$itemmaster: 'Item Master uuid',
|
$stock: "Stock",
|
||||||
$room: 'Room uuid',
|
},
|
||||||
$itemorigin: 'Item Origin uuid',
|
selling_price_percentage: {
|
||||||
$batch: 'Batch',
|
$item_master_id: "Item Master ID (required, UUID)",
|
||||||
$exp_date: 'Exp Date',
|
$item_origin_id: "Item Origin ID (required, UUID)",
|
||||||
$stock: 'Stock'
|
$percentage: "Percentage (required, number, min 0, max 999.99, 2 decimal places)",
|
||||||
},
|
},
|
||||||
selling_price_percentage: {
|
patient_group: {
|
||||||
$item_master_id: 'Item Master ID (required, UUID)',
|
$patient_group_name: "PatientGroup name",
|
||||||
$item_origin_id: 'Item Origin ID (required, UUID)',
|
},
|
||||||
$percentage: 'Percentage (required, number, min 0, max 999.99, 2 decimal places)'
|
patient_guarantor: {
|
||||||
},
|
$guarantor_name: "PatientGuarantor name",
|
||||||
patient_group: {
|
$phone: "08123456789", // Nomor telepon
|
||||||
$patient_group_name: 'PatientGroup name',
|
$province: "West Java", // Provinsi
|
||||||
},
|
$city: "Bandung", // Kota
|
||||||
patient_guarantor: {
|
$zip_code: "40123", // Kode Pos
|
||||||
$guarantor_name: 'PatientGuarantor name',
|
$agreement_no: "AG123456789", // Nomor Perjanjian
|
||||||
$phone: '08123456789', // Nomor telepon
|
$agreement_desc: "Health Insurance Agreement", // Deskripsi Perjanjian (opsional)
|
||||||
$province: 'West Java', // Provinsi
|
$patient_group_id: "2e1a1b33-bbb2-4f33-b2c4-cff5976f3f95", // Patient Group (UUID)
|
||||||
$city: 'Bandung', // Kota
|
},
|
||||||
$zip_code: '40123', // Kode Pos
|
refferal_hospital: {
|
||||||
$agreement_no: 'AG123456789', // Nomor Perjanjian
|
$refferal_hospital_name: "RefferalHospital name",
|
||||||
$agreement_desc: 'Health Insurance Agreement', // Deskripsi Perjanjian (opsional)
|
},
|
||||||
$patient_group_id: '2e1a1b33-bbb2-4f33-b2c4-cff5976f3f95', // Patient Group (UUID)
|
user_to_room: {
|
||||||
},
|
$user_id: "user ID (required, UUID)",
|
||||||
refferal_hospital: {
|
$room_ids: "Array [room-uuid-1, room-uuid-2]",
|
||||||
$refferal_hospital_name: 'RefferalHospital name',
|
},
|
||||||
},
|
room_to_pharmacy: {
|
||||||
user_to_room: {
|
$pharmacy_room_id: "Pharmacy Room ID (required, UUID)",
|
||||||
$user_id: 'user ID (required, UUID)',
|
$room_ids: "Array [room-uuid-1, room-uuid-2]",
|
||||||
$room_ids: 'Array [room-uuid-1, room-uuid-2]'
|
},
|
||||||
},
|
planning_verificator: {
|
||||||
room_to_pharmacy: {
|
$user_id: "User ID (required, UUID)",
|
||||||
$pharmacy_room_id: 'Pharmacy Room ID (required, UUID)',
|
},
|
||||||
$room_ids: 'Array [room-uuid-1, room-uuid-2]'
|
scheduleRecurrence: {
|
||||||
},
|
$type: { "@enum": ["daily", "weekly", "monthly"] },
|
||||||
planning_verificator: {
|
$interval: 1,
|
||||||
$user_id: 'User ID (required, UUID)'
|
$daysOfWeek: ["MO", "WE", "FR"],
|
||||||
},
|
},
|
||||||
scheduleRecurrence: {
|
scheduleSeriesCreate: {
|
||||||
$type: { "@enum": ["daily", "weekly", "monthly"] },
|
$roomId: "uuid-string",
|
||||||
$interval: 1,
|
$doctorId: "uuid-string",
|
||||||
$daysOfWeek: ["MO", "WE", "FR"]
|
$title: "Practice Schedule",
|
||||||
},
|
$timezone: "Asia/Jakarta",
|
||||||
scheduleSeriesCreate: {
|
$quota: 20,
|
||||||
$roomId: "uuid-string",
|
$startDate: "2026-03-20",
|
||||||
$doctorId: "uuid-string",
|
$untilDate: "2026-06-30",
|
||||||
$title: "Practice Schedule",
|
$startTimeLocal: "09:00:00",
|
||||||
$timezone: "Asia/Jakarta",
|
$endTimeLocal: "12:00:00",
|
||||||
$quota: 20,
|
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" },
|
||||||
$startDate: "2026-03-20",
|
},
|
||||||
$untilDate: "2026-06-30",
|
scheduleSeriesUpdate: {
|
||||||
$startTimeLocal: "09:00:00",
|
$roomId: "uuid-string",
|
||||||
$endTimeLocal: "12:00:00",
|
$doctorId: "uuid-string",
|
||||||
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" }
|
$title: "Practice Schedule Updated",
|
||||||
},
|
$timezone: "Asia/Jakarta",
|
||||||
scheduleSeriesUpdate: {
|
$quota: 25,
|
||||||
$roomId: "uuid-string",
|
$startDate: "2026-03-20",
|
||||||
$doctorId: "uuid-string",
|
$untilDate: "2026-07-31",
|
||||||
$title: "Practice Schedule Updated",
|
$startTimeLocal: "10:00:00",
|
||||||
$timezone: "Asia/Jakarta",
|
$endTimeLocal: "13:00:00",
|
||||||
$quota: 25,
|
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" },
|
||||||
$startDate: "2026-03-20",
|
},
|
||||||
$untilDate: "2026-07-31",
|
scheduleSeriesDetail: {
|
||||||
$startTimeLocal: "10:00:00",
|
$id: "uuid-string",
|
||||||
$endTimeLocal: "13:00:00",
|
$room_id: "uuid-string",
|
||||||
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" }
|
$doctor_id: "uuid-string",
|
||||||
},
|
$title: "Practice Schedule",
|
||||||
scheduleSeriesDetail: {
|
$timezone: "Asia/Jakarta",
|
||||||
$id: "uuid-string",
|
$quota: 20,
|
||||||
$room_id: "uuid-string",
|
$start_date: "2026-03-20",
|
||||||
$doctor_id: "uuid-string",
|
$until_date: "2026-06-30",
|
||||||
$title: "Practice Schedule",
|
$start_time_local: "09:00:00",
|
||||||
$timezone: "Asia/Jakarta",
|
$end_time_local: "12:00:00",
|
||||||
$quota: 20,
|
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" },
|
||||||
$start_date: "2026-03-20",
|
$status: "Active",
|
||||||
$until_date: "2026-06-30",
|
$room: { id: "uuid-string", room: "Room 1" },
|
||||||
$start_time_local: "09:00:00",
|
$doctor: { id: "uuid-string", name: "Dr A" },
|
||||||
$end_time_local: "12:00:00",
|
},
|
||||||
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" },
|
scheduleExceptionCreate: {
|
||||||
$status: "Active",
|
$occurrenceDate: "2026-03-24",
|
||||||
$room: { id: "uuid-string", room: "Room 1" },
|
$isCancelled: false,
|
||||||
$doctor: { id: "uuid-string", name: "Dr A" }
|
$overrideRoomId: "uuid-string",
|
||||||
},
|
$overrideDoctorId: "uuid-string",
|
||||||
scheduleExceptionCreate: {
|
$overrideTitle: "Override Practice",
|
||||||
$occurrenceDate: "2026-03-24",
|
$overrideStartAt: "2026-03-24T10:00:00.000Z",
|
||||||
$isCancelled: false,
|
$overrideEndAt: "2026-03-24T12:30:00.000Z",
|
||||||
$overrideRoomId: "uuid-string",
|
},
|
||||||
$overrideDoctorId: "uuid-string",
|
scheduleCalendarResource: {
|
||||||
$overrideTitle: "Override Practice",
|
$id: "room-1:doctor-1",
|
||||||
$overrideStartAt: "2026-03-24T10:00:00.000Z",
|
$roomId: "room-1",
|
||||||
$overrideEndAt: "2026-03-24T12:30:00.000Z"
|
$roomName: "Room 1",
|
||||||
},
|
$doctorId: "doctor-1",
|
||||||
scheduleCalendarResource: {
|
$doctorName: "Dr A",
|
||||||
$id: "room-1:doctor-1",
|
},
|
||||||
$roomId: "room-1",
|
scheduleCalendarEvent: {
|
||||||
$roomName: "Room 1",
|
$id: "occ:series-101:2026-03-20",
|
||||||
$doctorId: "doctor-1",
|
$seriesId: "series-101",
|
||||||
$doctorName: "Dr A"
|
$resourceId: "room-1:doctor-1",
|
||||||
},
|
$title: "Practice",
|
||||||
scheduleCalendarEvent: {
|
$startAt: "2026-03-20T09:00:00+07:00",
|
||||||
$id: "occ:series-101:2026-03-20",
|
$endAt: "2026-03-20T12:00:00+07:00",
|
||||||
$seriesId: "series-101",
|
$quota: 20,
|
||||||
$resourceId: "room-1:doctor-1",
|
$usedQuota: 7,
|
||||||
$title: "Practice",
|
$leftQuota: 13,
|
||||||
$startAt: "2026-03-20T09:00:00+07:00",
|
$isRecurring: true,
|
||||||
$endAt: "2026-03-20T12:00:00+07:00",
|
$isException: false,
|
||||||
$quota: 20,
|
$status: "confirmed",
|
||||||
$usedQuota: 7,
|
},
|
||||||
$leftQuota: 13,
|
scheduleCalendarMeta: {
|
||||||
$isRecurring: true,
|
$total_count: 24,
|
||||||
$isException: false,
|
$page: 1,
|
||||||
$status: "confirmed"
|
$limit: 20,
|
||||||
},
|
},
|
||||||
scheduleCalendarMeta: {
|
faretype: {
|
||||||
$total_count: 24,
|
$name: "Name (string)",
|
||||||
$page: 1,
|
},
|
||||||
$limit: 20
|
card_type: {
|
||||||
},
|
$name: "Name (string)",
|
||||||
faretype: {
|
},
|
||||||
$name: 'Name (string)',
|
payment_method: {
|
||||||
},
|
$name: "Name (string)",
|
||||||
},
|
},
|
||||||
parameters: {
|
},
|
||||||
|
parameters: {},
|
||||||
},
|
securitySchemes: {
|
||||||
securitySchemes: {
|
bearerAuth: {
|
||||||
bearerAuth: {
|
type: "http",
|
||||||
type: 'http',
|
scheme: "bearer",
|
||||||
scheme: 'bearer'
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const outputFile = './swagger.json';
|
const outputFile = "./swagger.json";
|
||||||
const routes = ['../routes/private.ts', '../routes/public.ts'];
|
const routes = ["../routes/private.ts", "../routes/public.ts"];
|
||||||
|
|
||||||
swaggerAutogen(outputFile, routes, doc);
|
swaggerAutogen(outputFile, routes, doc);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user