Skip to content

Add employee database and CRUD API endpoints - #75

Open
Lekhaaa-S wants to merge 1 commit into
UniCourt:mainfrom
Lekhaaa-S:add-employee-api
Open

Lekhaaa-S wants to merge 1 commit into
UniCourt:mainfrom
Lekhaaa-S:add-employee-api

Conversation

@Lekhaaa-S

Copy link
Copy Markdown

What this does

Adds an Employee model with 4 API endpoints and an admin view for viewing saved data.

APIs

  • POST /employees/api/add/ — add new employee
  • GET /employees/api/<emp_id>/ — get employee by emp_id
  • DELETE /employees/api/<emp_id>/delete/ — delete employee by id
  • PUT /employees/api/<emp_id>/salary/ — update employee salary

Admin view

Employee model registered in Django admin (/admin/) to view saved data.

Testing

Verified all 4 endpoints with curl and confirmed correct behavior:

  • Add: creates employee, returns 201 with employee data
  • Get: returns employee by emp_id, 404 if not found
  • Update salary: updates and returns updated employee
  • Delete: removes employee, confirmed 404 on subsequent get

Also verified in browser via Django admin panel at /admin/.

Adds Employee model, Django admin registration, and 4 API endpoints: add, get by emp_id, delete by id, update salary.
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