This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express, { Request, Response, NextFunction } from 'express'; | |
import helmet from 'helmet'; | |
import cors from 'cors'; | |
import compression from 'compression'; | |
import rateLimit from 'express-rate-limit'; | |
import { v4 as uuidv4 } from 'uuid'; | |
import 'reflect-metadata'; | |
import { Container } from 'typedi'; | |
import { logger, createRequestLogger, logStartup, logShutdown } from './utils/logger'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pgPromise from 'pg-promise'; | |
import type { IDatabase, IMain } from 'pg-promise'; | |
import { Service } from 'typedi'; | |
export type DatabaseConnection = IDatabase<Record<string, never>>; | |
@Service() | |
export class DatabaseService { | |
private static instance: DatabaseService; | |
private pgp: IMain; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { DatabaseConnection } from '@/config/database'; | |
export interface PaginatedResult<T> { | |
data: T[]; | |
total: number; | |
page: number; | |
limit: number; | |
totalPages: number; | |
hasNextPage: boolean; | |
hasPreviousPage: boolean; |