Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #9

Merged
merged 62 commits into from
Jul 30, 2023
Merged

Dev #9

merged 62 commits into from
Jul 30, 2023

Conversation

Kaduh15
Copy link
Owner

@Kaduh15 Kaduh15 commented Jul 28, 2023

No description provided.

…il' for consistency across repositories

The 'findByEmail' method in the 'UserRepositoryInMemory' and 'UserPrismaRepository' classes has been renamed to 'getByEmail' to provide a consistent naming convention across all user repositories. This improves code readability and maintainability.
…login method to ensure it returns a token when given valid login credentials
…ser-in-memory.repository.spec.ts

🔧 fix(auth.service.spec.ts): update test description to be more specific and accurate
…r readability and consistency

🔒 test(auth.service.spec.ts): add import statement for NotFoundError from utils/http-errors to fix missing import error
…s module to fix reference error

✅ test(auth.service.spec.ts): add test case to throw an error if password is invalid during login
…database schema

📝 chore(schema.prisma): add 'queue' model to the Prisma schema
…o implement QueueRepository interface

This commit adds a new file `queue-prisma.repository.ts` which contains the implementation of the `QueueRepository` interface. The `QueuePrismaRepository` class provides methods for creating, retrieving, updating, and deleting queues using Prisma ORM. Currently, all methods throw an error as they are not yet implemented.
…ry interfaces

- Added `QueuePrismaRepository` class that implements the `QueueRepository` interface.
- The `QueuePrismaRepository` class contains methods for creating, retrieving, updating, and deleting queues.
- The `QueueRepository` interface extends the `BaseRepository` interface and defines the contract for queue repositories.
…nused queue repository files

The queue-prisma.repository.ts and queue.repository.ts files were removed as they were no longer being used in the project. This cleanup improves code organization and reduces clutter.
… 'queue' table

🔧 chore(schema.prisma): update 'queue' model to reflect the column name change from 'phone' to 'phoneNumber'
…operations

📦 chore(queue-router): add queue router to handle queue-related requests
📦 chore(queue-router): add queue controller to handle queue-related logic
📦 chore(queue-router): add queue service to handle queue-related operations
📦 chore(queue-router): add queue create schema for request body validation
…y create a new queue in the database

✨ feat(queue-prisma.repository.ts): return the created queue object after successfully creating it in the database
…the same name already exists to prevent duplicate queues
@ghost
Copy link

ghost commented Jul 28, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

The test file 'index.spec.ts' was removed as it was no longer needed.
…er modules

🔧 fix(user-router.spec): replace prisma.user.findUnique with userRepository.getByEmail and prisma.user.create with userRepository.create to use the exported userRepository instead of prisma directly
…userRepository to improve testability and decouple from specific ORM implementation
…cking and resetting mocks

🔧 fix(user-router.spec.ts): replace sinon.stub().resolves with vi.fn().mockResolvedValue for mocking repository methods
…n().mockResolvedValue() to improve test readability and maintainability
…and maintainability

🔀 chore(index.ts): add exports for auth-router and queue-router to consolidate route exports
🔀 chore(user-router/index.ts): rename usersRouter to userRouter for consistency with file name and improve semantics
…ueue" table with "WAITING" as default value

📝 docs(schema.prisma): add "status" field to "queue" model with "WAITING" as default value and create "Status" enum with values "WAITING", "ABSENT", and "DONE"
…Repository to retrieve queues created today

✨ feat(queue.repository.ts): add getToday method to QueueRepository interface to enforce implementation in concrete repositories
…rt from 1 instead of 0 to match the first queue id

🔒 chore(queue-in-memory.repository.ts): make queues and index private to encapsulate internal state
✨ feat(queue-in-memory.repository.ts): implement deleteAll method to clear all queues in memory repository
…s to retrieve today's queues

🔧 chore(queue.service.ts): refactor create() method in QueueService class for better readability and maintainability
…se real timers, and delete all queues before each test case

🔬 test(queue.service.spec.ts): add async/await to 'Should create a queue' test case to properly handle promises
🔬 test(queue.service.spec.ts): add 'getToday' test case to test the 'getToday' method of QueueService
🔬 test(queue.service.spec.ts): add assertions to 'getToday' test case to ensure correct behavior
🐛 fix(queue.controller): use http-status-codes library to improve readability and maintainability of status codes in responses
…enRouter in the app

🔀 merge(routes/index.ts): export open-router module to allow importing and using openRouter in the app
…the status of the queue

✨ feat(queue-in-memory.repository.ts): set default status of newly created queues to 'WAITING'
🔧 fix(queue.repository.ts): add create method to QueueRepository interface to create a new queue without specifying id, status, createdAt, and updatedAt properties
…Today query to use Date objects instead of string conversion
…e to exclude unnecessary properties from the data parameter

🐛 fix(queue-prisma.repository.ts): fix create method signature to exclude unnecessary properties from the data parameter
…reusability and modularity

🔀 refactor(queue-router/index.ts): change route path from '/' to '/today' for better clarity and consistency
…ble for better code readability and maintainability
…to restrict access to ADMIN users

🔧 chore(queue-router): refactor POST / route to include authentication middleware before validation and controller functions
…re a length of 11 characters instead of 9 to match the expected format
… have 11 digits instead of 9

🔒 chore(queue-router.spec.ts): add authorization header to create queue test to simulate authenticated request
…columns to Open table

🔧 chore(schema.prisma): update Open model to include createdAt and updatedAt columns
…ons related to the Open entity

📦 chore(open.repository.ts): import Open entity and BaseRepository to enable usage in the file
…tation

📦 chore(open.repository.ts): add OpenRepository type definition
…teAll methods in OpenPrismaRepository

🔥 chore(open.respository.ts): remove unused OpenRepository file
…nRepository to improve modularity and testability

🔧 refactor(open.service.ts): replace prisma.open.create with model.create to improve code readability and maintainability
🔧 refactor(open.service.ts): replace prisma.open.findUnique with model.getById to improve code readability and maintainability
🔧 refactor(open.service.ts): replace prisma.open.update with model.update to improve code readability and maintainability
… OpenPrismaRepository to improve separation of concerns and maintainability
…y class to provide in-memory storage for Open entities

🐛 fix(open-in-memory.repository.ts): fix delete method to correctly handle index not found error
…ad of "vitest" to enable running tests in development mode
…rations before running the app

🔧 chore(docker-compose.dev.yml): add db-studio service to run database migrations and seed data
@sonarcloud
Copy link

sonarcloud bot commented Jul 30, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Kaduh15 Kaduh15 merged commit f250f00 into main Jul 30, 2023
3 checks passed
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.

1 participant