This commit is contained in:
2026-04-17 13:28:22 +07:00
parent a9878c691f
commit cc25ae1fe9
6 changed files with 1309 additions and 988 deletions

3
.gitignore vendored
View File

@ -8,4 +8,5 @@ dist/
temp/ temp/
package-lock.json package-lock.json
src/swagger/swagger.json src/swagger/swagger.json
swagger.json swagger.json
.prettierrc

282
src/controllers/currency.ts Normal file
View File

@ -0,0 +1,282 @@
import config from "config";
import { Paging, Status, Currency } from "entity";
import { NextFunction, Response } from "express";
import { Request } from "express-jwt";
import Joi from "joi";
import { ILogObj, Logger } from "tslog";
import CommonHelper from "../helpers/common";
import { ReturnHelper } from "../helpers/express/return";
import { OrmHelper } from "../helpers/orm";
import { Language } from "../langs/lang";
import fs from "fs";
import { CurrencyModel } from "../model/currencies";
const log: Logger<ILogObj> = new Logger({
name: "[CurrencyController]",
type: "pretty",
});
export class CurrencyController {
static async list(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
/*
#swagger.tags = ['Currency']
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['filter'] = {
descriptionk:'',
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"),
});
const param: Paging = await schema.validateAsync(req.query);
const offset = (param.page - 1) * param.limit;
const filter = JSON.parse(param.filter);
const query = await CurrencyModel.list(filter);
const limit = param.limit;
const res_count = query;
const res_list = query
.orderBy("Currency." + 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 create(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
/*
#swagger.tags = ['Currency']
#swagger.security = [{
"bearerAuth": []
}]
#swagger.requestBody = {
required: true,
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/currency"
}
}
}
}
*/
try {
const schema = Joi.object().keys({
name: Joi.string().required().label("Name"),
symbol: Joi.string().required().label("Symbol"),
status: Joi.string().uuid().required().valid("Y", "N").label("Status"),
});
const param = await schema.validateAsync(req.body);
const data = new Currency();
data.name = param.name;
data.symbol = param.symbol;
data.status = param.status;
data.created_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, 400, 401, Language.lang.failed_insert, err.message);
}
}
static async detail(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#swagger.tags = ['Currency']
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['id'] = {
in: 'path',
description: 'Currency ID.',
required: true,
type: 'string'
}
*/
try {
const schema = Joi.object().keys({
id: Joi.string().required().label("ID"),
});
let param: any = await schema.validateAsync(req.params);
let data = await CurrencyModel.list({ id: param.id }).then((q) => q.getOne());
if (!data) throw { message: "Currency " + Language.lang.failed_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, 500, 402, Language.lang.failed_view, err.message);
}
}
static async update(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
/*
#swagger.tags = ['Currency']
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['id'] = {
description:'',
in: 'path',
type: 'string'
}
#swagger.requestBody = {
required: true,
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/currency"
}
}
}
}
*/
const queryRunner = OrmHelper.DB.createQueryRunner();
await queryRunner.startTransaction();
try {
req.body.id = req.params["id"];
const schema = Joi.object().keys({
id: Joi.string().required().label("Bank ID"),
name: Joi.string().required().label("Name"),
symbol: Joi.string().required().label("Symbol"),
status: Joi.string().uuid().required().valid("Y", "N").label("Status"),
});
let param: any = await schema.validateAsync(req.body);
let currency: Currency = await CurrencyModel.list({ id: param.currency_id }).then((q) => q.getOne());
if (!currency) throw { message: "Currnecy " + Language.lang.failed_not_found };
currency.name = param.name;
currency.symbol = param.symbol;
currency.status = param.status;
await queryRunner.manager.save(currency);
await queryRunner.commitTransaction();
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_update, currency);
} catch (e: unknown) {
await queryRunner.rollbackTransaction();
log.error(e);
const err = e as Error;
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
} finally {
await queryRunner.release();
}
}
static async delete(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#swagger.tags = ['Currency']
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['id'] = {
in: 'path',
description: 'Bank 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(Currency);
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);
}
}
}

View File

@ -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 { ResponsiblePartyConsent, Province, City, Subdistrict, Ward, RefferalHospital, RegistrationFee, FareType, RoomStock, Administrativu, Aldeia, District, Menu, Munisipo, Suco, Application, Nationality, Diagnosis, DiagnosticProcedure, Room, ServiceType, ServiceClass, Service, ServiceFare, ServicePackage, Department, DoctorSchedule, MeasurementUnit, ReferenceRange, QueueMonitoring, QueueMonitoringRooms, 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"; import { ResponsiblePartyConsent, Province, City, Subdistrict, Ward, RefferalHospital, RegistrationFee, FareType, RoomStock, Administrativu, Aldeia, District, Menu, Munisipo, Suco, Application, Nationality, Diagnosis, DiagnosticProcedure, Room, ServiceType, ServiceClass, Service, ServiceFare, ServicePackage, Department, DoctorSchedule, MeasurementUnit, ReferenceRange, QueueMonitoring, QueueMonitoringRooms, 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, Currency, 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;
@ -58,6 +58,7 @@ export class OrmHelper {
ItemType, ItemType,
ItemTypeDetail, ItemTypeDetail,
Unit, Unit,
Currency,
ItemCategory, ItemCategory,
ItemStatus, ItemStatus,
UsageInstructions, UsageInstructions,

27
src/model/currencies.ts Normal file
View File

@ -0,0 +1,27 @@
import { Currency } from "entity";
import { SelectQueryBuilder } from "typeorm";
import CommonHelper from "../helpers/common";
import { OrmHelper } from "../helpers/orm";
export class CurrencyModel {
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
const repo = OrmHelper.DB.getRepository(Currency);
let whereAttr = [];
let whereVal: any = {};
if (filter) {
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter).whereAttr];
whereVal = {
...whereVal,
...CommonHelper.handleQueryFilter(filter).whereVal,
};
}
var query = null;
query = repo.createQueryBuilder();
if (whereAttr.length != 0) {
query = query.where(whereAttr.join(" and "), whereVal);
}
return query;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,494 +2,499 @@ 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: [ servers: [
{ {
url: config.get("server.host_swagger"), url: config.get("server.host_swagger"),
description: "Environtment " + config.get("app.env"), description: "Environtment " + config.get("app.env"),
}, },
], ],
components: { components: {
schemas: { schemas: {
product: { product: {
$code: "123456", $code: "123456",
$name: "Product name", $name: "Product name",
$description: "Product description", $description: "Product description",
$source: "trialBalanceBranch / cifAccount / lnkolek", $source: "trialBalanceBranch / cifAccount / lnkolek",
$status: "Y", $status: "Y",
}, },
branch: { branch: {
$code: "123456", $code: "123456",
$name: "Branch name", $name: "Branch name",
$status: "Y", $status: "Y",
}, },
menu: { currency: {
$module: "Dashboard", $name: "Dolar",
$name: "Dashboard", $symbol: "$",
$link: "/", $status: "Y",
$id_parent: "", },
$order_number: 1, menu: {
$icon: "", $module: "Dashboard",
$application: "ukln", $name: "Dashboard",
$status: "Y", $link: "/",
}, $id_parent: "",
administrativu: { $order_number: 1,
$code: "123456", $icon: "",
$name: "Administrativu name", $application: "ukln",
$status: "Y", $status: "Y",
$munisipo_id: "uuid-string", },
}, administrativu: {
application: { $code: "123456",
$id: "ukln", $name: "Administrativu name",
$name: "Dashboard Performance Business", $status: "Y",
$reset_password_url: "https://brilianapps.britimorleste.tl/ukln/auth/reset-password/", $munisipo_id: "uuid-string",
$status: "Y", },
}, application: {
aldeia: { $id: "ukln",
$code: "123456", $name: "Dashboard Performance Business",
$name: "Aldeia name", $reset_password_url: "https://brilianapps.britimorleste.tl/ukln/auth/reset-password/",
$status: "Y", $status: "Y",
$suco_id: "uuid-string", },
}, aldeia: {
class_economi: { $code: "123456",
$code: "123456", $name: "Aldeia name",
$name: "Class economi name", $status: "Y",
$status: "Y", $suco_id: "uuid-string",
}, },
district: { class_economi: {
$code: "123456", $code: "123456",
$name: "District name", $name: "Class economi name",
$status: "Y", $status: "Y",
}, },
income_tier: { district: {
$code: "123456", $code: "123456",
$name: "Income tier name", $name: "District name",
$status: "Y", $status: "Y",
}, },
munisipo: { income_tier: {
$code: "123456", $code: "123456",
$name: "Munisipo name", $name: "Income tier name",
$status: "Y", $status: "Y",
}, },
suco: { munisipo: {
$code: "123456", $code: "123456",
$name: "Suco name", $name: "Munisipo name",
$status: "Y", $status: "Y",
$administrativu_id: "uuid-string", },
}, suco: {
nationality: { $code: "123456",
$code: "123456", $name: "Suco name",
$name: "Nationality name", $status: "Y",
$status: "Y", $administrativu_id: "uuid-string",
}, },
classEconomi: { nationality: {
$code: "123456", $code: "123456",
$name: "Class Economi name", $name: "Nationality name",
$status: "Y", $status: "Y",
}, },
incomeTier: { classEconomi: {
$code: "123456", $code: "123456",
$name: "Income Tier name", $name: "Class Economi name",
$status: "Y", $status: "Y",
}, },
diagnosis: { incomeTier: {
$diagnosis: "Diagnosis name (ICD-11)", $code: "123456",
$code: "ABC123", $name: "Income Tier name",
$status: "Y", $status: "Y",
}, },
diagnostic_procedure: { diagnosis: {
$diagnosticProcedure: "Procedure name (ICD-9)", $diagnosis: "Diagnosis name (ICD-11)",
$code: "XYZ789", $code: "ABC123",
$status: "Y", $status: "Y",
}, },
room: { diagnostic_procedure: {
$room: "Room name", $diagnosticProcedure: "Procedure name (ICD-9)",
$code: "R001", $code: "XYZ789",
$description: "Optional description", $status: "Y",
$department_id: "uuid-string", },
$serviceclass: "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: { $serviceclass: "uuid-string",
$room: "Room name", $status: "Y",
$code: "R001", $location: "Room location",
$description: "Optional description", $picture: "Room picture name",
$department_id: "uuid-string", },
$status: "Y", laboratory: {
}, $room: "Room name",
// pharmacy: { $code: "R001",
// $room: "Room name", $description: "Optional description",
// $code: "R001", $department_id: "uuid-string",
// $description: "Optional description", $status: "Y",
// $department_id: "uuid-string", },
// $status: "Y" // pharmacy: {
// }, // $room: "Room name",
serviceType: { // $code: "R001",
$name: "Registration & Tickets", // $description: "Optional description",
$status: { "@enum": ["Y", "N"] }, // $department_id: "uuid-string",
}, // $status: "Y"
serviceClass: { // },
$name: "Class name", serviceType: {
}, $name: "Registration & Tickets",
service: { $status: { "@enum": ["Y", "N"] },
$name: "e.g. ER Registration", },
$service_type_id: "uuid-string", serviceClass: {
$status: { "@enum": ["Y", "N"] }, $name: "Class name",
}, },
roomServices: { service: {
$service_ids: ["uuid-string"], $name: "e.g. ER Registration",
}, $service_type_id: "uuid-string",
serviceFare: { $status: { "@enum": ["Y", "N"] },
$service_id: "uuid-string", },
$faretype: [ roomServices: {
{ $service_ids: ["uuid-string"],
$faretype_id: "uuid-string", },
$service_class: [ serviceFare: {
{ $service_id: "uuid-string",
$service_class_id: "uuid-string", $faretype: [
$fare: 100000, {
} $faretype_id: "uuid-string",
] $service_class: [
} {
] $service_class_id: "uuid-string",
}, $fare: 100000,
servicePackage: { },
$name: "Package name", ],
$service_class_id: "uuid-string", },
$fare: 500000, ],
$service_ids: ["uuid-string"], },
}, servicePackage: {
department: { $name: "Package name",
$name: "igd", $service_class_id: "uuid-string",
$status: { "@enum": ["Y", "N"] }, $fare: 500000,
}, $service_ids: ["uuid-string"],
doctorSchedule: { },
$day: "Senin", department: {
$start_time: "08:00", $name: "igd",
$end_time: "12:00", $status: { "@enum": ["Y", "N"] },
$doctor_id: "uuid-string", },
$room_id: "uuid-string", doctorSchedule: {
$quota: "20", $day: "Senin",
$status: { "@enum": ["Y", "N"] }, $start_time: "08:00",
}, $end_time: "12:00",
doctorItem: { $doctor_id: "uuid-string",
$doctor_id: "uuid-string", $room_id: "uuid-string",
$item_master_id: "uuid-string", $quota: "20",
}, $status: { "@enum": ["Y", "N"] },
doctorItemPackage: { },
$doctor_id: "uuid-string", doctorItem: {
$name: "Paket Obat Harian", $doctor_id: "uuid-string",
$description: "Optional description", $item_master_id: "uuid-string",
$item_master_ids: ["uuid-string"], },
$active: true, doctorItemPackage: {
}, $doctor_id: "uuid-string",
measurementUnit: { $name: "Paket Obat Harian",
$unit: "Milligram", $description: "Optional description",
$status: { "@enum": ["Y", "N"] }, $item_master_ids: ["uuid-string"],
}, $active: true,
referenceRange: { },
$gender: { "@enum": ["male", "female"] }, measurementUnit: {
$age_range_min: "0 | (days)", $unit: "Milligram",
$age_range_max: "20 | (days)", $status: { "@enum": ["Y", "N"] },
$value_min: "13.7", },
$value_max: "17.5", referenceRange: {
$status: { "@enum": ["Y", "N"] }, $gender: { "@enum": ["male", "female"] },
}, $age_range_min: "0 | (days)",
queueMonitoring: { $age_range_max: "20 | (days)",
$name: "Ground Floor Queue", $value_min: "13.7",
$slug: "ground-floor-queue", $value_max: "17.5",
$room_ids: ["uuid-string"], $status: { "@enum": ["Y", "N"] },
$status: { "@enum": ["Y", "N"] }, },
}, queueMonitoring: {
examinationType: { $name: "Ground Floor Queue",
$name: "Examination Type name", $slug: "ground-floor-queue",
$status: { "@enum": ["Y", "N"] }, $room_ids: ["uuid-string"],
$service_ids: ["uuid-string"], $status: { "@enum": ["Y", "N"] },
}, },
examinationDetail: { examinationType: {
$name: "Examination Detail name", $name: "Examination Type name",
$order_no: "Order number", $status: { "@enum": ["Y", "N"] },
$measurement_unit_id: "uuid-string", $service_ids: ["uuid-string"],
$reference_range_ids: "[] array uuid-string", },
$status: { "@enum": ["Y", "N"] }, examinationDetail: {
}, $name: "Examination Detail name",
serviceExamination: { $order_no: "Order number",
$examination_detail_ids: ["uuid-string"], $measurement_unit_id: "uuid-string",
}, $reference_range_ids: "[] array uuid-string",
serviceExaminationCreate: { $status: { "@enum": ["Y", "N"] },
$examination_detail_ids: ["uuid-string"], },
$service_id: "uuid-string", serviceExamination: {
}, $examination_detail_ids: ["uuid-string"],
hospitalinformation: { },
$name: "Hospital Name", serviceExaminationCreate: {
$address: "Hospital Address", $examination_detail_ids: ["uuid-string"],
$phone: "Hospital Phone", $service_id: "uuid-string",
$logo: "Hospital Logo", },
}, hospitalinformation: {
files: { $name: "Hospital Name",
$file_name: "File Name", $address: "Hospital Address",
}, $phone: "Hospital Phone",
item_group: { $logo: "Hospital Logo",
$group_name: "ItemGroup name", },
}, files: {
item_origin: { $file_name: "File Name",
$origin_name: "ItemOrigin name", },
$origin_description: "ItemOrigin Desc", item_group: {
$department: "Department name", $group_name: "ItemGroup name",
$account: "Account name", },
}, item_origin: {
item_type: { $origin_name: "ItemOrigin name",
$type_name: "ItemType name", $origin_description: "ItemOrigin Desc",
$item_group_id: "ItemGroup Id", $department: "Department name",
}, $account: "Account name",
item_type_detail: { },
$type_detail_name: "ItemTypeDetail name", item_type: {
$item_type_id: "ItemType Id", $type_name: "ItemType name",
}, $item_group_id: "ItemGroup Id",
unit: { },
$unit_name: "Unit name", item_type_detail: {
$small_unit: "Small unit name", $type_detail_name: "ItemTypeDetail name",
$large_unit: "Large unit name", $item_type_id: "ItemType Id",
}, },
item_category: { unit: {
$category_name: "ItemCategory name", $unit_name: "Unit name",
}, $small_unit: "Small unit name",
item_status: { $large_unit: "Large unit name",
$status_name: "Itemstatus name", },
}, item_category: {
item_class: { $category_name: "ItemCategory name",
$item_class_name: "ItemClass name", },
}, item_status: {
item_class_detail: { $status_name: "Itemstatus name",
$class_detail_name: "ItemClassDetail name", },
}, item_class: {
usage_instructions: { $item_class_name: "ItemClass name",
$usage_instructions_name: "UsageInstructions name", },
$usage_instructions_abbreviation: "UsageInstructions Abbreviation", item_class_detail: {
}, $class_detail_name: "ItemClassDetail name",
usage_time: { },
$usage_time_name: "UsageInstructions name", usage_instructions: {
$usage_time_abbreviation: "UsageInstructions Abbreviation", $usage_instructions_name: "UsageInstructions name",
}, $usage_instructions_abbreviation: "UsageInstructions Abbreviation",
generic_name: { },
$generic_name: "Generic name", usage_time: {
}, $usage_time_name: "UsageInstructions name",
factory: { $usage_time_abbreviation: "UsageInstructions Abbreviation",
$factory_name: "factory name", },
$address: "Factory address", generic_name: {
$web: "Factory url web", $generic_name: "Generic name",
$phone: "Factory phone", },
$email: "Factory email", factory: {
}, $factory_name: "factory name",
supplier: { $address: "Factory address",
$supplier_name: "supplier name", $web: "Factory url web",
$address: "supplier address", $phone: "Factory phone",
$phone: "supplier phone", $email: "Factory email",
$email: "supplier email", },
}, supplier: {
factory_to_supplier: { $supplier_name: "supplier name",
$supplier_id: "Supplier ID (required, UUID)", $address: "supplier address",
$factory_ids: "Array [factory-uuid-1, factory-uuid-2]", $phone: "supplier phone",
}, $email: "supplier email",
item_master: { },
$item_name: "Item name", factory_to_supplier: {
$generic_name_id: "Generic name ID (UUID)", $supplier_id: "Supplier ID (required, UUID)",
$item_type_detail_id: "Item type detail ID (UUID)", $factory_ids: "Array [factory-uuid-1, factory-uuid-2]",
$item_category_id: "Item category ID (UUID)", },
$item_class_id: "Item class ID (UUID)", item_master: {
$item_class_detail_id: "Item class Detail ID (UUID)", $item_name: "Item name",
$item_status_id: "Item status ID (UUID)", $generic_name_id: "Generic name ID (UUID)",
$factory_id: "Factory ID (UUID)", $item_type_detail_id: "Item type detail ID (UUID)",
// $unit_id: "Unit ID (UUID)", $item_category_id: "Item category ID (UUID)",
$smallunit:"string", $item_class_id: "Item class ID (UUID)",
$largeunit:"string", $item_class_detail_id: "Item class Detail ID (UUID)",
$pack_size: "Pack size (integer, minimum 0)", $item_status_id: "Item status ID (UUID)",
$minimum_quantity: "Minimum quantity (integer, minimum 0)", $factory_id: "Factory ID (UUID)",
$minimum_sales_quantity: "Minimum sales quantity (integer, minimum 0)", // $unit_id: "Unit ID (UUID)",
$strength: "Strength value (number, minimum 0)", $smallunit: "string",
$active: "Active status (boolean)", $largeunit: "string",
}, $pack_size: "Pack size (integer, minimum 0)",
pharmacy_info: { $minimum_quantity: "Minimum quantity (integer, minimum 0)",
$logo: "Logo (string, max 256)", $minimum_sales_quantity: "Minimum sales quantity (integer, minimum 0)",
$name: "Name (string, max 256)", $strength: "Strength value (number, minimum 0)",
$address: "Address (string, max 500)", $active: "Active status (boolean)",
$munisipiu: "Munisipiu ID (UUID)", },
$postu_admin: "Postu Admin ID (UUID)", pharmacy_info: {
$suco: "Suco ID (UUID)", $logo: "Logo (string, max 256)",
$aldeia: "Aldeia ID (UUID)", $name: "Name (string, max 256)",
$phone: "Phone (string, max 30, optional)", $address: "Address (string, max 500)",
$default_room_id: "Default Room ID (UUID)", $munisipiu: "Munisipiu ID (UUID)",
$province: "Province Code", $postu_admin: "Postu Admin ID (UUID)",
$city: "City Code", $suco: "Suco ID (UUID)",
$subdistrict: "Subdistrict Code", $aldeia: "Aldeia ID (UUID)",
$ward: "Ward Code", $phone: "Phone (string, max 30, optional)",
}, $default_room_id: "Default Room ID (UUID)",
item_price: { $province: "Province Code",
$item_master_id: "Item Master ID (required, UUID)", $city: "City Code",
$purchase_price: "Purchase Price (required, number, minimum 0)", $subdistrict: "Subdistrict Code",
$selling_price: "Selling Price (required, number, minimum 0)", $ward: "Ward Code",
$expired_date: "Expired Date (required, date)", },
}, item_price: {
initial_stock: { $item_master_id: "Item Master ID (required, UUID)",
$itemmaster: "Item Master uuid", $purchase_price: "Purchase Price (required, number, minimum 0)",
$room: "Room uuid", $selling_price: "Selling Price (required, number, minimum 0)",
$itemorigin: "Item Origin uuid", $expired_date: "Expired Date (required, date)",
$batch: "Batch", },
$exp_date: "Exp Date", initial_stock: {
$stock: "Stock", $itemmaster: "Item Master uuid",
}, $room: "Room uuid",
selling_price_percentage: { $itemorigin: "Item Origin uuid",
$item_master_id: "Item Master ID (required, UUID)", $batch: "Batch",
$item_origin_id: "Item Origin ID (required, UUID)", $exp_date: "Exp Date",
$percentage: "Percentage (required, number, min 0, max 999.99, 2 decimal places)", $stock: "Stock",
}, },
patient_group: { selling_price_percentage: {
$patient_group_name: "PatientGroup name", $item_master_id: "Item Master ID (required, UUID)",
}, $item_origin_id: "Item Origin ID (required, UUID)",
patient_guarantor: { $percentage: "Percentage (required, number, min 0, max 999.99, 2 decimal places)",
$guarantor_name: "PatientGuarantor name", },
$phone: "08123456789", // Nomor telepon patient_group: {
$province: "West Java", // Provinsi $patient_group_name: "PatientGroup name",
$city: "Bandung", // Kota },
$zip_code: "40123", // Kode Pos patient_guarantor: {
$agreement_no: "AG123456789", // Nomor Perjanjian $guarantor_name: "PatientGuarantor name",
$agreement_desc: "Health Insurance Agreement", // Deskripsi Perjanjian (opsional) $phone: "08123456789", // Nomor telepon
$patient_group_id: "2e1a1b33-bbb2-4f33-b2c4-cff5976f3f95", // Patient Group (UUID) $province: "West Java", // Provinsi
$faretype: "3f1a1b33-bbb2-4f33-b2c4-cff5976f3f95", // Fare Type (UUID) $city: "Bandung", // Kota
$maximalliability: 1000000, // Maximal Liability (opsional) $zip_code: "40123", // Kode Pos
}, $agreement_no: "AG123456789", // Nomor Perjanjian
refferal_hospital: { $agreement_desc: "Health Insurance Agreement", // Deskripsi Perjanjian (opsional)
$refferal_hospital_name: "RefferalHospital name", $patient_group_id: "2e1a1b33-bbb2-4f33-b2c4-cff5976f3f95", // Patient Group (UUID)
}, $faretype: "3f1a1b33-bbb2-4f33-b2c4-cff5976f3f95", // Fare Type (UUID)
user_to_room: { $maximalliability: 1000000, // Maximal Liability (opsional)
$user_id: "user ID (required, UUID)", },
$room_id: "Room ID (required, UUID)", refferal_hospital: {
}, $refferal_hospital_name: "RefferalHospital name",
user_to_room_update: { },
$user_id: "user ID (required, UUID)", user_to_room: {
$room_ids: "Array [room-uuid-1, room-uuid-2]", $user_id: "user ID (required, UUID)",
}, $room_id: "Room ID (required, UUID)",
room_to_pharmacy: { },
$room_id: "room ID (required, UUID)", user_to_room_update: {
$pharmacy_room_id: "Pharmacy Room ID (required, UUID)", $user_id: "user ID (required, UUID)",
}, $room_ids: "Array [room-uuid-1, room-uuid-2]",
planning_verificator: { },
$user_id: "User ID (required, UUID)", room_to_pharmacy: {
}, $room_id: "room ID (required, UUID)",
scheduleRecurrence: { $pharmacy_room_id: "Pharmacy Room ID (required, UUID)",
$type: { "@enum": ["daily", "weekly", "monthly"] }, },
$interval: 1, planning_verificator: {
$daysOfWeek: ["MO", "WE", "FR"], $user_id: "User ID (required, UUID)",
}, },
scheduleSeriesCreate: { scheduleRecurrence: {
$roomId: "uuid-string", $type: { "@enum": ["daily", "weekly", "monthly"] },
$doctorId: "uuid-string", $interval: 1,
$title: "Practice Schedule", $daysOfWeek: ["MO", "WE", "FR"],
$timezone: "Asia/Jakarta", },
$quota: 20, scheduleSeriesCreate: {
$startDate: "2026-03-20", $roomId: "uuid-string",
$untilDate: "2026-06-30", $doctorId: "uuid-string",
$startTimeLocal: "09:00:00", $title: "Practice Schedule",
$endTimeLocal: "12:00:00", $timezone: "Asia/Jakarta",
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" }, $quota: 20,
}, $startDate: "2026-03-20",
scheduleSeriesUpdate: { $untilDate: "2026-06-30",
$roomId: "uuid-string", $startTimeLocal: "09:00:00",
$doctorId: "uuid-string", $endTimeLocal: "12:00:00",
$title: "Practice Schedule Updated", $recurrence: { $ref: "#/components/schemas/scheduleRecurrence" },
$timezone: "Asia/Jakarta", },
$quota: 25, scheduleSeriesUpdate: {
$startDate: "2026-03-20", $roomId: "uuid-string",
$untilDate: "2026-07-31", $doctorId: "uuid-string",
$startTimeLocal: "10:00:00", $title: "Practice Schedule Updated",
$endTimeLocal: "13:00:00", $timezone: "Asia/Jakarta",
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" }, $quota: 25,
}, $startDate: "2026-03-20",
scheduleSeriesDetail: { $untilDate: "2026-07-31",
$id: "uuid-string", $startTimeLocal: "10:00:00",
$room_id: "uuid-string", $endTimeLocal: "13:00:00",
$doctor_id: "uuid-string", $recurrence: { $ref: "#/components/schemas/scheduleRecurrence" },
$title: "Practice Schedule", },
$timezone: "Asia/Jakarta", scheduleSeriesDetail: {
$quota: 20, $id: "uuid-string",
$start_date: "2026-03-20", $room_id: "uuid-string",
$until_date: "2026-06-30", $doctor_id: "uuid-string",
$start_time_local: "09:00:00", $title: "Practice Schedule",
$end_time_local: "12:00:00", $timezone: "Asia/Jakarta",
$recurrence: { $ref: "#/components/schemas/scheduleRecurrence" }, $quota: 20,
$status: "Active", $start_date: "2026-03-20",
$room: { id: "uuid-string", room: "Room 1" }, $until_date: "2026-06-30",
$doctor: { id: "uuid-string", name: "Dr A" }, $start_time_local: "09:00:00",
}, $end_time_local: "12:00:00",
scheduleExceptionCreate: { $recurrence: { $ref: "#/components/schemas/scheduleRecurrence" },
$occurrenceDate: "2026-03-24", $status: "Active",
$isCancelled: false, $room: { id: "uuid-string", room: "Room 1" },
$overrideRoomId: "uuid-string", $doctor: { id: "uuid-string", name: "Dr A" },
$overrideDoctorId: "uuid-string", },
$overrideTitle: "Override Practice", scheduleExceptionCreate: {
$overrideStartAt: "2026-03-24T10:00:00.000Z", $occurrenceDate: "2026-03-24",
$overrideEndAt: "2026-03-24T12:30:00.000Z", $isCancelled: false,
}, $overrideRoomId: "uuid-string",
scheduleCalendarResource: { $overrideDoctorId: "uuid-string",
$id: "room-1:doctor-1", $overrideTitle: "Override Practice",
$roomId: "room-1", $overrideStartAt: "2026-03-24T10:00:00.000Z",
$roomName: "Room 1", $overrideEndAt: "2026-03-24T12:30:00.000Z",
$doctorId: "doctor-1", },
$doctorName: "Dr A", scheduleCalendarResource: {
}, $id: "room-1:doctor-1",
scheduleCalendarEvent: { $roomId: "room-1",
$id: "occ:series-101:2026-03-20", $roomName: "Room 1",
$seriesId: "series-101", $doctorId: "doctor-1",
$resourceId: "room-1:doctor-1", $doctorName: "Dr A",
$title: "Practice", },
$startAt: "2026-03-20T09:00:00+07:00", scheduleCalendarEvent: {
$endAt: "2026-03-20T12:00:00+07:00", $id: "occ:series-101:2026-03-20",
$quota: 20, $seriesId: "series-101",
$usedQuota: 7, $resourceId: "room-1:doctor-1",
$leftQuota: 13, $title: "Practice",
$isRecurring: true, $startAt: "2026-03-20T09:00:00+07:00",
$isException: false, $endAt: "2026-03-20T12:00:00+07:00",
$status: "confirmed", $quota: 20,
}, $usedQuota: 7,
scheduleCalendarMeta: { $leftQuota: 13,
$total_count: 24, $isRecurring: true,
$page: 1, $isException: false,
$limit: 20, $status: "confirmed",
}, },
faretype: { scheduleCalendarMeta: {
$name: "Name (string)", $total_count: 24,
}, $page: 1,
card_type: { $limit: 20,
$name: "Name (string)", },
}, faretype: {
payment_method: { $name: "Name (string)",
$name: "Name (string)", },
}, card_type: {
registration_fee: { $name: "Name (string)",
type: "emergency | outpatient", },
service: ["uuid-string-1", "uuid-string-2"] payment_method: {
}, $name: "Name (string)",
serviceFareUpdate: { },
$fare: 100000, registration_fee: {
}, type: "emergency | outpatient",
responsiblepartyconsent:{ service: ["uuid-string-1", "uuid-string-2"],
$bodytext: "string" },
} serviceFareUpdate: {
}, $fare: 100000,
parameters: {}, },
securitySchemes: { responsiblepartyconsent: {
bearerAuth: { $bodytext: "string",
type: "http", },
scheme: "bearer", },
}, parameters: {},
}, securitySchemes: {
}, bearerAuth: {
type: "http",
scheme: "bearer",
},
},
},
}; };
const outputFile = "./swagger.json"; const outputFile = "./swagger.json";