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

Implement getCompany(<companyId>) endpoint on the backend #14

Open
izzyconner opened this issue Mar 1, 2024 · 0 comments
Open

Implement getCompany(<companyId>) endpoint on the backend #14

izzyconner opened this issue Mar 1, 2024 · 0 comments
Assignees

Comments

@izzyconner
Copy link
Contributor

izzyconner commented Mar 1, 2024

Implement a new Company module, with CompanyController and CompanyService classes similar to what can be found for the UserModule. Create an endpoint that, given a company ID, gets the company data and all the user data or at least user IDs for that company.

Currently, there is a BreaktimeCompanyToUsers table in DynamoDB. In the backend code, there is a method called GetCompanyData in apps/backend/src/dynamodb.ts:88 that can read the data from this table and return it formatted as CompanySchema found in apps/backend/src/db/schemas/CompanyUsers.ts.

There should be a getCompany(<companyId>) endpoint on the backend that will return the data from this table for a given company.

The schema for a company and the data that is returned by this endpoint should be:

CompanyId: string,
CompanyName: string,
AssociateIds: string[],
SupervisorIds: string[]

If there is no company that can be found from the given companyId, the endpoint should return an error, like a 404 Not Found.

As a stretch goal, the endpoint should retrieve the UserData for each associate and supervisor (this can be done by utilizing the existing methods in UserService and combine that data in the response, so the return schema looks like:

CompanyId: string,
CompanyName: string,
AssociateIds: UserModel[],
SupervisorIds: UserModel[]
@izzyconner izzyconner transferred this issue from Code-4-Community/breaktime-backend Mar 1, 2024
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

No branches or pull requests

2 participants