hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
182 stars 105 forks source link

[FEAT]: Database Setup #251

Closed nadduli closed 1 month ago

nadduli commented 1 month ago

Description

Set up a database for the chosen framework’s ORM, allowing configuration for any database but defaulting to Postgres. Follow migrations, models, and service patterns to ensure a robust and flexible database setup.

Acceptance Criteria

  1. Database Configuration:

    • Set up the database for the chosen framework’s ORM.
    • The setup should allow configuration for any database, with Postgres as the default.
    • Follow migrations, models, and service patterns.
  2. Validation:

    • Create the following tables and constraints:
      • Users: A user has one profile.
      • Profiles: A user has one profile.
      • Organisations: A user belongs to many organisations. An organisation has many users.
      • Products: A user has many products.
    • Seed the tables with the following data:
      • At least 2 users.
      • At least 2 products per user.
      • At least 3 organisations.
      • User one belongs to 2 of the organisations.
      • User two belongs to all 3 organisations.

Example Data

  1. Tables and Constraints:

    • Users table
    • Profiles table
    • Organisations table
    • Products table
    • Relationships:
      • A user has one profile.
      • A user has many products.
      • A user belongs to many organisations.
      • An organisation has many users.
  2. Table Seeding:

    • Users: At least 2 users.
    • Products: At least 2 products per user.
    • Organisations: At least 3 organisations.
    • User one belongs to 2 of the organisations.
    • User two belongs to all 3 organisations.

Example Endpoints

Implementation

  1. Clone the boilerplate for your framework.
  2. Create a branch named chore/database-setup from the base branch.
  3. Implement the database setup as described above.

Expected Outcome

Testing

Notes

markessien commented 1 month ago

DB setup tasks will not be accepted as tickets