0% found this document useful (0 votes)
2 views5 pages

Notes

notes

Uploaded by

Aswin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Notes

notes

Uploaded by

Aswin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Prod URL: [Link]

com
Swagger URL: [Link]

1. Manager
Create Manager

POST /api/managers/

{
"name": "Aditya",
"shift": "morning"
}

• shift is usually one of: "morning", "afternoon", “night"

List managers

GET /api/managers/
[
{
"id": 1,
"name": "Aditya",
"shift": "morning"
}
]

2. Supervisor
Create supervisor

POST /api/supervisors/
{
"name": "Aswin",
"place_work": "Warehouse A",
"shift": "morning",
"manager_id": 1
}

List supervisors

GET /api/supervisors/
[
{
"id": 1,
"name": “Aswin",
"place_work": "Warehouse 1",
"shift": "morning",
"manager_id": 1
}
]
3. Employee
Create employee

POST /api/employees/
{
"name": “Aman",
"employee_type": "permanent",
"shift": "morning",
"skills": ["Scanning", "Pushing", "Unloading"],
"status": "present",
"supervisor_id": 1
}

List employees

GET /api/employees/
[
{
"id": 1,
"name": "Aman",
"employee_type": "permanent", // e.g. "permanent" or "temporary"
"shift": "morning",
"skills": ["Scanning", "Pushing", "Unloading"],
"status": "present", // present/sick/vacation/seminar
"supervisor_id": 1
}
]

4. Task Requirements (how many people per task)

Create Task requirement

POST /api/task-requirements/
{
"task": "Scanning",
"required_count": 8,
"shift": "morning",
"date": "2025-11-27"
}

List task requirements

GET /api/task-requirements/
[
{
"id": 1,
"task": "Scanning",
"required_count": 8,
"shift": "morning",
"date": "2025-11-27"
}
]
Front‑end can build a simple UI:

• Select date and shift


• Specify each task’s required_count

3. Daily Attendance
Bulk mark everyone as present for a date

POST /api/attendance/bulk/

Request:
{
"date": "2025-11-27"
}

Response:
{
"date": "2025-11-27",
"created_count": 50
}
This creates DailyAttendance rows for all employees with status "present" for that date.

4. Mark one employee’s status (exception: sick/vacation/seminar)


POST /api/attendance/mark/
{
"employee": 10,
"date": "2025-11-27",
"status": "sick" // "sick", "vacation", "seminar"
}

5. Get attendance list for a date


GET /api/attendance/?date=2025-11-27

[
{
"id": 1,
"employee": 10,
"date": "2025-11-27",
"status": "sick"
},
{
"id": 2,
"employee": 11,
"date": "2025-11-27",
"status": “vacation"
}
]

Attendance summary for a date (for dashboard)


GET /api/attendance/summary/?date=2025-11-27
Frontend can show simple cards: Present / Sick / Vacation / Seminar counts per day.
6. Task Job Assignment Generation
Main endpoint the UI uses to generate and view task assignments.

Generate Task + View Task for a date & shift

GET /api/assignments/?shift=morning&date=2025-11-27
Query params:

shift: "morning", "afternoon", or "night".


date: "YYYY-MM-DD".

{
"date": "2025-11-27",
"shift": "morning",
"min_employees_required": 40,
"present_employees": 35,
"assignments": [
{
"employee_id": 1,
"employee_name": "Aman",
"employee_type": "permanent",
"supervisor_id": 1,
"supervisor_name": "Aswin",
"manager_id": 1,
"manager_name": "Aditya",
"task": "Scanning",
"shift": "morning",
"date": "2025-11-27"
},
{
"employee_id": 2,
"employee_name": "Akil",
"employee_type": "temporary",
"supervisor_id": 1,
"supervisor_name": "Aman",
"manager_id": 1,
"manager_name": "Aditya",
"task": "Pushing",
"shift": "morning",
"date": "2025-11-27"
}
]
}

Conditions Used:
• Looks at DailyAttendance API to find employees with status == "present" for that date.
• Only includes employees whose shift matches the requested shift.
• Uses TaskRequirement API for that date+shift to know how many required for each task.
• Employee skills (task must be in skills list).
• Rotation (don’t give same task as yesterday).
• No duplicate task for the same employee/date/shift.
Frontend workflow: (for the final task generation API)
• Select date and shift.
• Ensure bulk attendance is done and exceptions are set.
• Call /api/assignments/?shift=...&date=....
• Display:
• Summary at top (min_employees_required, present_employees).
• Table of assignments with employee name, supervisor, manager, task.

Frontend Workflow for whole project:

• Managers & Supervisors


Create managers via /api/managers/.
Create supervisors via /api/supervisors/ with manager_id.

• Employees
Create employees via /api/employees/ with supervisor_id, skills, shift.

• Task Requirements
For each date+shift, set tasks + required_count via /api/task-requirements/.

• Bulk attendance
UI button: “Mark all present for Date”. [As a default marks present for all employee]
POST /api/attendance/bulk/ { "date": “yyyy-mm-dd“ }.

• For each exception like (sick/vacation/seminar),


POST /api/attendance/mark/ with that employee, date, and status.

• View attendance summary (Employee Report)


Show GET /api/attendance/summary/?date=Date.

• Generate assignments
Call GET /api/assignments/?shift=…&date=..…
Display summary + assignments in UI.

You might also like