{"id":22080906,"url":"https://github.com/codermungan/employee","last_synced_at":"2025-03-23T20:46:14.819Z","repository":{"id":264017879,"uuid":"892105674","full_name":"CoderMungan/employee","owner":"CoderMungan","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-24T23:22:27.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T04:27:43.344Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CoderMungan.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-21T14:17:38.000Z","updated_at":"2024-11-24T23:22:30.000Z","dependencies_parsed_at":"2024-11-21T15:26:27.652Z","dependency_job_id":"a82d22b7-a54c-43b0-b124-938ec9e04cc7","html_url":"https://github.com/CoderMungan/employee","commit_stats":null,"previous_names":["codermungan/employee"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderMungan%2Femployee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderMungan%2Femployee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderMungan%2Femployee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderMungan%2Femployee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoderMungan","download_url":"https://codeload.github.com/CoderMungan/employee/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245168809,"owners_count":20571800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T23:18:47.038Z","updated_at":"2025-03-23T20:46:14.803Z","avatar_url":"https://github.com/CoderMungan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# General Information\n\n- Language: Python\n- Framework: Django and Django REST Framework (DRF)\n- Database: PostgreSQL\n- Asynchronous Tasks: Celery + Redis\n- Authentication: JWT (JSON Web Token)\n\n## Modules and Structure\n\n- CustomUser:\n  - A custom user model extending Django's AbstractBaseUser.\n  - Allows users to log in using email.\n  - Key Fields:\n    - annual_leave_days: Total annual leave days for the user.\n    - remaining_leave_days: Remaining leave days.\n    - used_leave_days: Used leave days.\n    - total_late_minutes: Total minutes of lateness.\n    - monthly_working_hours: Total working hours for the current month.\n  - Relationships:\n    - worklog: Many-to-Many relationship with WorkLog.\n    - leaverequest: Many-to-Many relationship with LeaveRequest.\n- WorkLog:\n  - Stores daily check-in/check-out records for users.\n  - Fields:\n    - date: Represents the workday.\n    - check_in_time and check_out_time: Check-in and check-out times.\n    - late_minutes: Daily late minutes.\n    - total_worked_hours: Total daily worked hours.\n- LeaveRequest:\n  - Manages annual leave requests for users.\n  - Fields:\n    - start_date and end_date: Start and end dates of the leave.\n    - status: Status of the leave (pending, approved, rejected).\n  - Relationships:\n    - Many-to-Many relationship with CustomUser.\n- Notification:\n  - Sends notifications to administrators.\n  - Fields:\n    - user: The user who will receive the notification (admin).\n    - message: Notification content.\n    - created_at: Notification creation timestamp.\n\n## Celery Tasks\n\n- send_notification_to_admin:\n  - Sends notifications to admins if a user's remaining leave days fall below 3.\n  - Prevents duplicate notifications by checking existing entries.\n- calculate_monthly_reports:\n  - Calculates users' monthly working hours and lateness.\n  - Deducts lateness from annual leave days.\n\n# API Endpoints\n\n## User Management\n\n- List Users\n\n  - URL: /api/users/\n  - Method: GET\n  - Permissions: Admins only.\n  - Description: Lists all users.\n  - Create User\n\n  - URL: /api/users/\n  - Method: POST\n  - Permissions: Admins only.\n  - Body Example:\n\n```json\n{\n  \"email\": \"user@example.com\",\n  \"password\": \"password123\",\n  \"first_name\": \"Ali\",\n  \"last_name\": \"Veli\",\n  \"is_manager\": false,\n  \"is_employee\": true\n}\n```\n\n- User Details\n\n  - URL: /api/users/\u003cid\u003e/\n  - Method: GET\n  - Permissions: Admins only.\n  - Description: Retrieves details of a specific user.\n\n## Attendance Management\n\n- Daily Summary\n\n  - URL: /api/worklog/daily-summary/\n  - Method: GET\n  - Permissions: All users.\n  - Description: Retrieves a summary of the user's daily work logs.\n\n- Check In\n\n  - URL: /api/worklog/check-in/\n  - Method: POST\n  - Permissions: All users.\n  - Description: Creates a check-in record for the user.\n\n- Check Out\n  - URL: /api/worklog/check-out/\n  - Method: POST\n  - Permissions: All users.\n  - Description: Creates a check-out record for the user.\n\n## Leave Request Management\n\n- List Leave Requests\n\n  - URL: /api/leaverequest/leave-requests/\n  - Method: GET\n  - Permissions: Employees can view their requests; managers can view all.\n  - Description: Lists leave requests.\n\n- Create Leave Request\n  - URL: /api/leaverequest/\n  - Method: POST\n  - Permissions: Employees only.\n  - Body Example:\n\n```json\n{\n  \"start_date\": \"2024-01-01\",\n  \"end_date\": \"2024-01-10\"\n}\n```\n\n- Approve Leave Request\n\n  - URL: /api/leaverequest/\u003cid\u003e/approve/\n  - Method: POST\n  - Permissions: Managers only.\n  - Description: Approves a specific leave request.\n\n- Reject Leave Request\n  - URL: /api/leaverequest/\u003cid\u003e/reject/\n  - Method: POST\n  - Permissions: Managers only.\n  - Description: Rejects a specific leave request.\n\n## Notification Management\n\n- List Notifications\n  - URL: /api/notifications/\n  - Method: GET\n  - Permissions: Admins only.\n  - Description: Lists notifications sent to administrators.\n  - Model Relationships\n  - CustomUser → WorkLog: Many-to-Many.\n  - CustomUser → LeaveRequest: Many-to-Many.\n  - Notification → CustomUser: ForeignKey.\n  - Authentication\n  - JWT Usage:\n  - Obtain tokens using the /api/token/ endpoint:\n\n```\n\n{\n\"email\": \"user@example.com\",\n\"password\": \"password123\"\n}\n```\n\n- Response example:\n\n```\n\n{\n\"access\": \"ACCESS_TOKEN\",\n\"refresh\": \"REFRESH_TOKEN\"\n}\n```\n\n- Permission Requirements:\n\n  - Employees can view their leave requests and work logs.\n  - Managers can view all users, leave requests, and notifications.\n\n## Running the Project with Docker\n\n```bash\ndocker-compose -f docker-compose.yml build\ndocker-compose -f docker-compose.yml run web python manage.py makemigrations\ndocker-compose -f docker-compose.yml run web python manage.py migrate\ndocker-compose -f docker-compose.yml up\n```\n\n# Notes:\n\n- I will do native language that:\n\n```bash\nEnviroment olarak database baglantilarini tutmak icin ugrasmadim sonuc olarak bir production mantigi soz konusu degil burada sizler icin rahatlik olmasi icin direk docker icerisinde bulunuyor.\nYalniz SECRET_KEY i tutmak durumunda kaldim bilginize.\nZevkli bir projeydi saygilarimi sunarim.\nSaygilarimi sunarim!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodermungan%2Femployee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodermungan%2Femployee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodermungan%2Femployee/lists"}