From 3414bdabdf39c21c716c08f0f10f41a1960d630d Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Wed, 1 Apr 2026 21:32:52 +0700 Subject: [PATCH 1/3] update:registration fee --- src/controllers/registrationfee.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/registrationfee.ts b/src/controllers/registrationfee.ts index efabcb1..4863288 100644 --- a/src/controllers/registrationfee.ts +++ b/src/controllers/registrationfee.ts @@ -100,7 +100,7 @@ export class RegistrationFeeController { /* #swagger.tags = ['Registration Fee'] #swagger.security = [{ "bearerAuth": [] }] - #swagger.parameters['id'] = { description: 'Room ID', in: 'path', type: 'string' } + #swagger.parameters['id'] = { description: 'ID', in: 'path', type: 'string' } #swagger.requestBody = { required: true, content: { "application/json": { schema: { $ref: "#/components/schemas/registration_fee" } } } } */ const queryRunner = OrmHelper.DB.createQueryRunner(); From a1bf5aed6521e8e79d6fb8ba9c3186a577926679 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Thu, 2 Apr 2026 09:45:58 +0700 Subject: [PATCH 2/3] update: refferal hospital add for option --- src/controllers/refferal_hospital.ts | 24 ++++++++++++++++++++++++ src/helpers/orm.ts | 5 +++-- src/routes/private.ts | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/controllers/refferal_hospital.ts b/src/controllers/refferal_hospital.ts index dd40367..38cd912 100644 --- a/src/controllers/refferal_hospital.ts +++ b/src/controllers/refferal_hospital.ts @@ -68,6 +68,30 @@ export class RefferalHospitalController { } } + static async option(req: Request, res: Response, next: NextFunction): Promise { + /* + #swagger.tags = ['RefferalHospital'] + #swagger.security = [{ "bearerAuth": [] }] + */ + try { + var query = await RefferalHospitalModel.list(); + + const res_count = query; + const res_list = query.orderBy("refferal_hospital.created_at", "DESC"); + + const current_page = 1; + 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 { /* #swagger.tags = ['RefferalHospital'] diff --git a/src/helpers/orm.ts b/src/helpers/orm.ts index 8b9febd..3f05c86 100644 --- a/src/helpers/orm.ts +++ b/src/helpers/orm.ts @@ -1,7 +1,7 @@ import config from 'config'; import { DataSource } from "typeorm"; import { ILogObj, Logger } from 'tslog'; -import { RegistrationFee,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' +import { 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, 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 { static DB: DataSource = null @@ -53,7 +53,8 @@ export class OrmHelper { FareType, CardType, PaymentMethod, - RegistrationFee + RegistrationFee, + RefferalHospital ], subscribers: [], migrations: [], diff --git a/src/routes/private.ts b/src/routes/private.ts index 2de78c8..622daf6 100644 --- a/src/routes/private.ts +++ b/src/routes/private.ts @@ -432,6 +432,7 @@ export class RoutePrivate { app.get('/api/patient-guarantor/view/:id', PatientGuarantorController.detail) app.get('/api/refferal-hospital/list', RefferalHospitalController.list) + app.get('/api/refferal-hospital/option', RefferalHospitalController.option) app.get('/api/refferal-hospital/export', RefferalHospitalController.export) app.post('/api/refferal-hospital/create', RefferalHospitalController.create) app.put('/api/refferal-hospital/update/:id', RefferalHospitalController.update) From 87745d4a5330538fa5a8b26d85d6fcf6f6124ef6 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Sun, 5 Apr 2026 11:39:05 +0700 Subject: [PATCH 3/3] update --- src/langs/lang.ts | 138 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 102 insertions(+), 36 deletions(-) diff --git a/src/langs/lang.ts b/src/langs/lang.ts index 06f94db..1e215f0 100644 --- a/src/langs/lang.ts +++ b/src/langs/lang.ts @@ -2,48 +2,114 @@ import path from 'path'; import fs from 'fs'; import { NextFunction, Request, Response } from 'express'; +// interface LanguageValue { +// success_insert?: string; +// success_update?: string; +// success_delete?: string; +// success_restore?: string; +// success_view?: string; +// success?: string; +// success_valid_otp?: string; + +// failed?: string; +// failed_access?: string; +// failed_access_otp?: string; +// failed_expired_otp?: string; +// failed_access_pin?: string; +// failed_try_pin?: string; +// failed_insert?: string; +// failed_update?: string; +// failed_delete?: string; +// failed_restore?: string; +// failed_save?: string; +// failed_view?: string; +// failed_empty?: string; +// failed_data?: string; +// failed_duplicate?: string; +// failed_not_found?: string; +// failed_limit_otp?: string; +// failed_limit_link_code?: string; +// failed_expired_token?: string; +// failed_token?: string; +// failed_add_point?: string; + +// //login +// success_login?: string; +// failed_password?: string; +// } + +// export class Language { +// static lang_init: LanguageValue = {}; +// static lang: LanguageValue = {}; + +// static setup() { +// const fileLang: any = fs.readFileSync( +// path.join(__dirname, '../langs/json/en.json') +// ); +// Language.lang_init['en'] = JSON.parse(fileLang.toString('utf8')); +// } + +// static apply = (req: Request, res: Response, next: NextFunction) => { +// const acceptLanguageHeader = req.get('Accept-Language') as string | null; +// if (!acceptLanguageHeader) { +// //default +// req.params.language = 'en'; +// } else { +// req.params.language = acceptLanguageHeader.substring(0, 2).toLowerCase(); +// } + +// Language.lang = Language.lang_init[req.params.language] ? Language.lang_init[req.params.language] : Language.lang_init['en']; + +// return next(); +// } +// } + interface LanguageValue { - success_insert?: string; - success_update?: string; - success_delete?: string; - success_restore?: string; - success_view?: string; - success?: string; - success_valid_otp?: string; + success_insert: string; + success_update: string; + success_delete: string; + success_restore: string; + success_view: string; + success: string; + success_valid_otp: string; - failed?: string; - failed_access?: string; - failed_access_otp?: string; - failed_expired_otp?: string; - failed_access_pin?: string; - failed_try_pin?: string; - failed_insert?: string; - failed_update?: string; - failed_delete?: string; - failed_restore?: string; - failed_save?: string; - failed_view?: string; - failed_empty?: string; - failed_data?: string; - failed_duplicate?: string; - failed_not_found?: string; - failed_limit_otp?: string; - failed_limit_link_code?: string; - failed_expired_token?: string; - failed_token?: string; - failed_add_point?: string; + failed: string; + failed_access: string; + failed_access_otp: string; + failed_expired_otp: string; + failed_access_pin: string; + failed_try_pin: string; + failed_insert: string; + failed_update: string; + failed_delete: string; + failed_restore: string; + failed_save: string; + failed_view: string; + failed_empty: string; + failed_data: string; + failed_duplicate: string; + failed_not_found: string; + failed_limit_otp: string; + failed_limit_link_code: string; + failed_expired_token: string; + failed_token: string; + failed_add_point: string; - //login - success_login?: string; - failed_password?: string; + success_login: string; + failed_password: string; +} + +// Tambah index signature agar bisa akses dengan ['en'] +interface LanguageStore { + [key: string]: LanguageValue; } export class Language { - static lang_init: LanguageValue = {}; - static lang: LanguageValue = {}; + static lang_init: LanguageStore = {}; + static lang: LanguageValue = {} as LanguageValue; static setup() { - const fileLang: any = fs.readFileSync( + const fileLang = fs.readFileSync( path.join(__dirname, '../langs/json/en.json') ); Language.lang_init['en'] = JSON.parse(fileLang.toString('utf8')); @@ -52,13 +118,13 @@ export class Language { static apply = (req: Request, res: Response, next: NextFunction) => { const acceptLanguageHeader = req.get('Accept-Language') as string | null; if (!acceptLanguageHeader) { - //default req.params.language = 'en'; } else { req.params.language = acceptLanguageHeader.substring(0, 2).toLowerCase(); } - Language.lang = Language.lang_init[req.params.language] ? Language.lang_init[req.params.language] : Language.lang_init['en']; + Language.lang = Language.lang_init[req.params.language] + ?? Language.lang_init['en']; return next(); }