How vishnukoushikbatreddy/swaya-attendence works
Swaya is a workforce attendance product: employees check in and out at assigned sites, while administrators manage staff, schedules, shifts, sites, live tracking, reports, and notifications. The web API and attendance service enforce attendance rules and persist records; a native Android service collects location in the background and queues uploads, including geofence events when the app is killed. The tree and source index support these major capabilities, but unsampled UI and API implementations limit confidence about their specific call paths.
Main entry points: attendance-service.ts Attendance service · models Attendance and workforce records · admin Admin portal · api-helpers.ts API access helpers
Components 30
Web experience
- Employee portal
src/app/(dashboard)/employee - Admin portal
src/app/(dashboard)/admin - Sign-in and signup
src/app/(auth)
Attendance workflows
- Attendance endpoints
src/app/api/attendance - Native ping endpoint
src/app/api/native/pings/route.ts - Geofence event endpoint
src/app/api/geofence-event/route.ts - Attendance service
src/lib/attendance-service.ts - Attendance rules
src/lib/attendance-logic.ts
Location tracking
- Android tracking service
android/app/src/main/java/com/swaya/attendance/LocationTrackingService.java - Device setup plugin
android/app/src/main/java/com/swaya/attendance/DeviceSetupPlugin.java - Ping queue
android/app/src/main/java/com/swaya/attendance/PingQueue.java - Ping uploader
android/app/src/main/java/com/swaya/attendance/PingUploader.java - Geofence plugin
android/app/src/main/java/com/swaya/attendance/GeofencePlugin.java - Geofence uploader
android/app/src/main/java/com/swaya/attendance/GeofenceUploader.java
Workforce administration
- Schedule endpoints
src/app/api/schedules - Admin endpoints
src/app/api/admin - Site endpoints
src/app/api/sites - Notification feed
src/app/api/notifications/route.ts - Attendance reports
src/app/api/reports/attendance
Application foundation
- Authentication and roles
src/lib/auth.ts - API access helpers
src/lib/api-helpers.ts - Request validation
src/lib/validators.ts - Native token verification
src/lib/native-token.ts - Database connection
src/lib/db.ts - Attendance and workforce records
src/models - Work-date and timezone rules
src/lib/workdate.ts - Company settings
src/lib/company.ts - CSV reporting
src/lib/csv.ts - Runtime configuration
src/lib/env.ts
Other components
- Employee or admin
Connections 48
- Employee or admin → Sign-in and signup: signs in
- Employee or admin → Employee portal: uses
- Employee or admin → Admin portal: uses
- Employee portal → Attendance endpoints: requests attendance
- Admin portal → Schedule endpoints: manages schedules
- Admin portal → Admin endpoints: manages employees
- Admin portal → Site endpoints: manages sites
- Admin portal → Notification feed: loads feed
- Admin portal → Attendance reports: requests reports
- Attendance endpoints → Attendance service: delegates attendance
src/app/api/attendance/today/route.ts - Native ping endpoint → Attendance service: processes pings
src/app/api/native/pings/route.ts - Native ping endpoint → API access helpers: uses helpers
src/app/api/native/pings/route.ts - Native ping endpoint → Request validation: validates batches
src/app/api/native/pings/route.ts - Native ping endpoint → Native token verification: verifies token
src/app/api/native/pings/route.ts - Native ping endpoint → Attendance and workforce records: reads and writes
src/app/api/native/pings/route.ts - Geofence event endpoint → Attendance service: processes transition
src/app/api/geofence-event/route.ts - Geofence event endpoint → Attendance rules: checks freshness
src/app/api/geofence-event/route.ts - Geofence event endpoint → Request validation: validates event
src/app/api/geofence-event/route.ts - Geofence event endpoint → Native token verification: verifies token
src/app/api/geofence-event/route.ts - Geofence event endpoint → Attendance and workforce records: checks employee
src/app/api/geofence-event/route.ts - Attendance service → Attendance rules: delegates decisions
src/lib/attendance-service.ts - Attendance service → Database connection: connects database
src/lib/attendance-service.ts - Attendance service → Attendance and workforce records: reads and writes
src/lib/attendance-service.ts - Attendance service → Work-date and timezone rules: resolves work dates
src/lib/attendance-service.ts - Attendance service → Company settings: loads timezone
src/lib/attendance-service.ts - Schedule endpoints → Attendance and workforce records: reads and writes schedules
src/app/api/schedules/route.ts - Schedule endpoints → Request validation: validates entries
src/app/api/schedules/route.ts - Schedule endpoints → Work-date and timezone rules: converts shift times
src/app/api/schedules/route.ts - Schedule endpoints → Attendance rules: resolves shift end
src/app/api/schedules/route.ts - Notification feed → Attendance and workforce records: reads and updates
src/app/api/notifications/route.ts - Notification feed → API access helpers: uses helpers
src/app/api/notifications/route.ts - Notification feed → Company settings: loads timezone
src/app/api/notifications/route.ts - Notification feed → Work-date and timezone rules: converts day bounds
src/app/api/notifications/route.ts - Attendance reports → Attendance and workforce records: queries records
src/app/api/reports/attendance/route.ts - Attendance reports → API access helpers: uses helpers
src/app/api/reports/attendance/route.ts - Attendance reports → CSV reporting: formats export
src/app/api/reports/attendance/route.ts - Android tracking service → Ping queue: queues location pings
android/app/src/main/java/com/swaya/attendance/LocationTrackingService.java - Android tracking service → Ping uploader: flushes ping batches
android/app/src/main/java/com/swaya/attendance/LocationTrackingService.java - Device setup plugin → Android tracking service: controls tracking
android/app/src/main/java/com/swaya/attendance/DeviceSetupPlugin.java - Device setup plugin → Android tracking service: configures alerts
android/app/src/main/java/com/swaya/attendance/DeviceSetupPlugin.java - Ping uploader → Ping queue: uploads queued pings
android/app/src/main/java/com/swaya/attendance/PingUploader.java - Geofence plugin → Geofence uploader: uses geofence helper
- Geofence uploader → Geofence uploader: uploads events
android/app/src/main/java/com/swaya/attendance/GeofenceUploader.java - Authentication and roles → Database connection: connects database
src/lib/auth.ts - Authentication and roles → Attendance and workforce records: loads user records
src/lib/auth.ts - API access helpers → Authentication and roles: loads auth options
src/lib/api-helpers.ts - API access helpers → Database connection: connects database
src/lib/api-helpers.ts - API access helpers → Attendance and workforce records: loads active user
src/lib/api-helpers.ts