Skip to content

Issue #36 — Backend: Invoice Entity & Module Scaffold #689

@yusuftomilola

Description

@yusuftomilola

Location: backend/src/invoices/

Description

ManageHub needs an Invoices module to maintain a permanent financial record for every successful payment on the platform. Each invoice is linked to a specific payment, booking, and member, and carries a human-readable invoice number that can be referenced in emails and PDF documents. This issue covers the foundational setup — the entity, enums, module, and bare service/controller stubs.

All monetary values must be stored in kobo as integers alongside a derived Naira value for convenience in display and PDF generation. The synchronize: true flag handles schema changes automatically.

Acceptance Criteria

  • An Invoice entity is created at backend/src/invoices/entities/invoice.entity.ts with the following fields:
    • id — UUID, primary key, auto-generated
    • invoiceNumber — string, unique — human-readable identifier (e.g. MH-INV-20260318-0001)
    • amountKobo — integer, required
    • amountNaira — decimal/float, required (derived from amountKobo / 100)
    • status — enum: PAID, PENDING — default PENDING
    • paidAt — timestamp, nullable
    • userId — UUID, foreign key referencing users
    • bookingId — UUID, foreign key referencing bookings
    • paymentId — UUID, foreign key referencing payments, nullable
    • user@ManyToOne relation to User entity
    • booking@ManyToOne relation to Booking entity
    • payment@ManyToOne relation to Payment entity, nullable
    • createdAt / updatedAt — auto timestamps
  • An InvoiceStatus enum is created at backend/src/invoices/enums/invoice-status.enum.ts
  • An InvoicesModule is created at backend/src/invoices/invoices.module.ts with TypeOrmModule.forFeature([Invoice]) registered
  • An InvoicesService stub is created at backend/src/invoices/providers/invoices.service.ts
  • An InvoicesController stub is created at backend/src/invoices/invoices.controller.ts with the @Controller('invoices') decorator
  • InvoicesModule is imported into backend/src/app.module.ts
  • npx tsc --noEmit passes with no errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions