Skip to content

Feat/auth#13

Closed
Mathieu-bot wants to merge 9 commits into
devfrom
feat/auth
Closed

Feat/auth#13
Mathieu-bot wants to merge 9 commits into
devfrom
feat/auth

Conversation

@Mathieu-bot

Copy link
Copy Markdown
Owner

Add Authentication Endpoints

  • Implements signup, login, logout, and get current user endpoints.
  • Uses Prisma for database access, bcrypt for password hashing, and JWT for authentication.
  • Sets secure HTTP-only cookies for sessions.
  • Includes input validation and error handling.

commit e91ae9d
Author: COCO <colomberakotonjanahary@gmail.com>
Date:   Sun Aug 24 19:18:50 2025 +0300

    Feat/income creation page (#11)

    * remove: prisma output custom path

    * chore: move lib folder in server root

    * chore(prisma): remove custom generator output and drop icon_emoji attribute from IncomeCategory model

    * feat(client): add income models

    * feat(server): implement income controller with full CRUD operations

    * feat(server): implement income category controller

    * feat(server): asyncHandler utility

    * refactor: separate controller and service logic for cleaner architecture

    * refactor: unify income and income-category controllers

    * feat: income routes

    * feat: GET /custom-categories endpoint to fetch categories created by the user

    * fix: correct income controller exports

    * chore: add temporary middleware to mock user (id: 4) for testing

    * fix(server): handle missing date field in income creation

    * fix(server): resolve invalid date type error

    * chore(api): make income.date optional and require category_id in OpenAPI spec

    * feat(client): implement income service

    * feat(client): custom react hooks for income data

    * feat: react-router-dom and setup initial routes for home and incomes

    * feat(client): income component and incomes page with full functionality

    * refactor: rename endpoints to /custom-categories in API spec and server to differenciate customized and system in built categories

    * feat: implement theme colors and fonts

    * feat: expandable sidebar

    * feat: setup theme colors and font

    * remove: icon_emoji column from income_category

    * fix: comprehensive error handling and validation for income categories

    * chore: regenerate openapi service after spec update

    * style: enhance loading component

    * fix: make date and source unrequired cause they have default fallbacks

    * fix: automatically refresh income list after CRUD operations

    * fix: improve income sorting to show most recent items first when dates are equal

    * feat: set Salary as default category for new income forms

    * feat: implement dedicated page routes for income creation and editing

    ---------

    Co-authored-by: Jonathan <rakotoarisoajonathan0@gmail.com>

commit 0672521
Author: Tsiory Jonathan <167012196+TsioryJonathan@users.noreply.github.com>
Date:   Sun Aug 24 15:21:56 2025 +0300

    Feat/basic dashboard layout (#9)

    * remove: prisma output custom path

    * chore: move lib folder in server root

    * chore(prisma): remove custom generator output and drop icon_emoji attribute from IncomeCategory model

    * feat(client): add income models

    * feat(server): implement income controller with full CRUD operations

    * feat(server): implement income category controller

    * feat(server): asyncHandler utility

    * refactor: separate controller and service logic for cleaner architecture

    * refactor: unify income and income-category controllers

    * feat: income routes

    * feat: GET /custom-categories endpoint to fetch categories created by the user

    * fix: correct income controller exports

    * chore: add temporary middleware to mock user (id: 4) for testing

    * fix(server): handle missing date field in income creation

    * fix(server): resolve invalid date type error

    * chore(api): make income.date optional and require category_id in OpenAPI spec

    * feat(client): implement income service

    * feat(client): custom react hooks for income data

    * feat: react-router-dom and setup initial routes for home and incomes

    * feat(client): income component and incomes page with full functionality

    * refactor: rename endpoints to /custom-categories in API spec and server to differenciate customized and system in built categories

    * feat: implement theme colors and fonts

    * feat: expandable sidebar

    * feat: setup theme colors and font

    ---------

    Co-authored-by: colombefioren <colomberakotonjanahary@gmail.com>

commit 536036e
Merge: fc8af84 3160a60
Author: Tafita Mathieu <hei.tafita.2@gmail.com>
Date:   Sat Aug 23 10:32:46 2025 -0400

    Merge pull request #3 from colombefioren/feat/prisma-integration

    Feat/prisma integration

commit 3160a60
Merge: 387ba2a fc8af84
Author: Tafita Mathieu <hei.tafita.2@gmail.com>
Date:   Sat Aug 23 10:30:12 2025 -0400

    Merge branch 'dev' into feat/prisma-integration

commit 387ba2a
Author: colombefioren <colomberakotonjanahary@gmail.com>
Date:   Sat Aug 23 13:21:17 2025 +0300

    refactor: change prisma.ts to prisma.js

commit 9498a64
Author: colombefioren <colomberakotonjanahary@gmail.com>
Date:   Sat Aug 23 13:16:03 2025 +0300

    feat: prisma service singleton

commit feca228
Author: colombefioren <colomberakotonjanahary@gmail.com>
Date:   Sat Aug 23 13:02:21 2025 +0300

    feat: income categories to schema

commit c06ba95
Author: colombefioren <colomberakotonjanahary@gmail.com>
Date:   Sat Aug 23 12:57:45 2025 +0300

    feat: define prisma schema models

commit bc0002e
Author: colombefioren <colomberakotonjanahary@gmail.com>
Date:   Sat Aug 23 12:48:53 2025 +0300

    feat: initialize prisma with postgresql setup

commit e282f34
Author: colombefioren <colomberakotonjanahary@gmail.com>
Date:   Sat Aug 23 12:45:26 2025 +0300

    chore: add prisma dependencies

commit ea8a0ee
Merge: b1366b7 cc6925d
Author: Tafita Mathieu <hei.tafita.2@gmail.com>
Date:   Sat Aug 16 07:39:40 2025 -0400

    Merge pull request #2 from Mathieu-bot/ui/components

    UI/components
@vercel

vercel Bot commented Aug 25, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
expense-tracker Ready Ready Preview Comment Aug 25, 2025 11:06am

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions

  • Avoid DATABASE queries in controllers, make dedicated services (so that each layer has a single responsability)
  • We can use ZOD instead of manual validation for reusable schemas across frontend/backend

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions — I agree.

  • Single Responsibility: We’ll move all DB access and business logic out of controllers and into dedicated services. Controllers will stay thin and only handle HTTP.
  • Validation: Since we already maintain an OpenAPI spec and generate the client SDK from it, we’ll keep OpenAPI as the single source of truth and enable runtime request validation via express-openapi-validator. This avoids duplicating schemas and keeps docs, SDK, and validation aligned.
  • If the team prefers Zod: I’m open to it. We can add Zod schemas for runtime validation on the server. To avoid double maintenance with the YAML, we could later generate OpenAPI from Zod. Otherwise, we accept maintaining both (YAML for SDK/doc; Zod for validation).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh alright! I don’t think it matters that we’re not using Zod.

- Add `validator` package to dependencies.
- Replace regex-based email validation with `validator.js` `isEmail`.
- Add password strength validation in the signup controller using
  `isStrongPassword` to enforce at least 6 characters, one uppercase
  letter, and one number.
- Create a new [validate.js] middleware to centralize validation logic.
- Implement [requireFields], [validateEmail], [sanitizeBody], and
  [validateTextMaxLengths] as reusable middleware functions.
- Create combined middlewares `validateSignup` and `validateLogin` to
  simplify route definitions.
- Update auth routes to use the new validation middlewares.
- Simplify the `auth.controller` by removing validation logic now
  handled by the middleware, keeping only the password strength check.
- Introduce custom error classes in utils/errors.js for better
  HTTP error handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants