add auth and payment api

This commit is contained in:
ItsMalma
2025-11-19 23:53:56 +07:00
parent 8f91994f29
commit 7e7a865368
64 changed files with 9067 additions and 2662 deletions

View File

@@ -1,6 +1,14 @@
import type { AbstractEmailService } from "@/common/services/email-service/abstract.email-service";
import { LibraryEmailService } from "@/common/services/email-service/library.email-service";
import type { AbstractFileStorage } from "@/common/services/file-storage/abstract.file-storage";
import { LocalFileStorage } from "@/common/services/file-storage/local.file-storage";
import type { AbstractJwtService } from "@/common/services/jwt-service/abstract.jwt-service";
import { LibraryJwtService } from "@/common/services/jwt-service/library.jwt-service";
import type { AbstractPaymentService } from "@/common/services/payment-service/abstract.payment-service";
import { MidtransPaymentService } from "@/common/services/payment-service/midtrans.payment-service";
import { serverConfig } from "@/configs/server.config";
import { AdminController } from "@/modules/admin/admin.controller";
import { AdminMapper } from "@/modules/admin/admin.mapper";
import { AirlineController } from "@/modules/airline/airline.controller";
import { AirlineMapper } from "@/modules/airline/airline.mapper";
import { AirportController } from "@/modules/airport/airport.controller";
@@ -15,8 +23,12 @@ import { HotelFacilityController } from "@/modules/hotel-facility/hotel-facility
import { HotelFacilityMapper } from "@/modules/hotel-facility/hotel-facility.mapper";
import { HotelController } from "@/modules/hotel/hotel.controller";
import { HotelMapper } from "@/modules/hotel/hotel.mapper";
import { OrderController } from "@/modules/order/order.controller";
import { OrderMapper } from "@/modules/order/order.mapper";
import { PackageController } from "@/modules/package/package.controller";
import { PackageMapper } from "@/modules/package/package.mapper";
import { PartnerController } from "@/modules/partner/partner.controller";
import { PartnerMapper } from "@/modules/partner/partner.mapper";
import { TransportationController } from "@/modules/transportation/transportation.controller";
import { TransportationMapper } from "@/modules/transportation/transportation.mapper";
import compression from "compression";
@@ -28,14 +40,20 @@ export class Application {
private readonly _app: express.Application;
// Services
private _emailService!: AbstractEmailService;
private _fileStorage!: AbstractFileStorage;
private _jwtService!: AbstractJwtService;
private _paymentService!: AbstractPaymentService;
public constructor() {
this._app = express();
}
public initializeServices() {
this._emailService = new LibraryEmailService();
this._fileStorage = new LocalFileStorage();
this._jwtService = new LibraryJwtService();
this._paymentService = new MidtransPaymentService();
}
public initializeMiddlewares() {
@@ -60,29 +78,66 @@ export class Application {
hotelMapper,
transportationMapper,
);
const adminMapper = new AdminMapper();
const partnerMapper = new PartnerMapper();
const orderMapper = new OrderMapper(packageMapper, partnerMapper);
const countryRouter = new CountryController(countryMapper).buildRouter();
const cityRouter = new CityController(cityMapper).buildRouter();
const countryRouter = new CountryController(
countryMapper,
this._jwtService,
).buildRouter();
const cityRouter = new CityController(
cityMapper,
this._jwtService,
).buildRouter();
const airlineRouter = new AirlineController(
airlineMapper,
this._fileStorage,
this._jwtService,
).buildRouter();
const airportRouter = new AirportController(
airportMapper,
this._jwtService,
).buildRouter();
const flightRouter = new FlightController(
flightMapper,
this._jwtService,
).buildRouter();
const airportRouter = new AirportController(airportMapper).buildRouter();
const flightRouter = new FlightController(flightMapper).buildRouter();
const hotelFacilityRouter = new HotelFacilityController(
hotelFacilityMapper,
this._jwtService,
).buildRouter();
const hotelRouter = new HotelController(
hotelMapper,
this._fileStorage,
this._jwtService,
).buildRouter();
const transportationRouter = new TransportationController(
transportationMapper,
this._fileStorage,
this._jwtService,
).buildRouter();
const packageRouter = new PackageController(
packageMapper,
this._fileStorage,
this._jwtService,
).buildRouter();
const adminRouter = new AdminController(
adminMapper,
this._fileStorage,
this._emailService,
this._jwtService,
).buildRouter();
const partnerRouter = new PartnerController(
partnerMapper,
this._fileStorage,
this._emailService,
this._jwtService,
).buildRouter();
const orderRouter = new OrderController(
orderMapper,
this._paymentService,
this._jwtService,
).buildRouter();
this._app.use("/countries", countryRouter);
@@ -94,6 +149,9 @@ export class Application {
this._app.use("/hotels", hotelRouter);
this._app.use("/transportations", transportationRouter);
this._app.use("/packages", packageRouter);
this._app.use("/admins", adminRouter);
this._app.use("/partners", partnerRouter);
this._app.use("/orders", orderRouter);
}
public initializeErrorHandlers() {}