https://github.com/ammezie/glover-maker-checker-api
https://github.com/ammezie/glover-maker-checker-api
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/ammezie/glover-maker-checker-api
- Owner: ammezie
- Created: 2022-07-14T14:33:01.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-14T14:33:05.000Z (almost 3 years ago)
- Last Synced: 2025-03-15T01:02:43.603Z (about 2 months ago)
- Language: PHP
- Size: 80.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Assumptions
Based on the task description, I went with the following assumptions:* The endpoints will be accessed by only admin users.
* Used a single `users` table for all users and having an `is_admin` column to indicate an admin.## Endpoints
* `POST` `/api/auth/register`: registers a new admin users.
* `POST` `/api/auth/login`: log an admin user in.
* `POST` `/api/auth/logout`: log an admin user out.
* `GET` `/api/requests`: a list of pending requests.
* `POST` `/api/requests`: create a new request. It accepts `type` and `data` (array of user details to be created, updated or deleted) as payload. Depending on the request type, `data` must contain the following:
* `create`: `first_name`, `last_name`, `email`, and `password`.
* `update`: `user_id`,`first_name`, `last_name`, and `email`.
* `delete`: `user_id`.
* `POST` `/api/requests/{id}/approve`: approve a pending request. It accepts the ID of the request to approve.
* `POST` `/api/requests/{id}/decline`: decline a pending request. It accepts the ID of the request to decline.