openapi: 3.1.0 info: title: Api version: 0.2.0 description: Absensi API - PT. Lembayung Wanantara Padha servers: - url: /api description: Base API path tags: - name: health description: Health check - name: auth description: Autentikasi - name: attendance description: Catatan absensi - name: leave description: Izin dan cuti - name: users description: Manajemen karyawan - name: notifications description: Notifikasi paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/login: post: operationId: login tags: [auth] summary: Login dengan email/ID dan password requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginInput" responses: "200": description: Login berhasil content: application/json: schema: $ref: "#/components/schemas/AuthResult" "401": description: Kredensial salah content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/register: post: operationId: register tags: [auth] summary: Registrasi akun karyawan baru requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterInput" responses: "201": description: Registrasi berhasil content: application/json: schema: $ref: "#/components/schemas/AuthResult" "400": description: Data tidak valid content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logout tags: [auth] summary: Logout responses: "200": description: Logout berhasil content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /auth/me: get: operationId: getMe tags: [auth] summary: Ambil data pengguna saat ini responses: "200": description: Data pengguna content: application/json: schema: $ref: "#/components/schemas/UserProfile" "401": description: Tidak terautentikasi content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /attendance/check-in: post: operationId: checkIn tags: [attendance] summary: Clock-in dengan foto dan GPS requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CheckInInput" responses: "201": description: Check-in berhasil content: application/json: schema: $ref: "#/components/schemas/AttendanceRecord" "400": description: Gagal check-in content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /attendance/check-out: post: operationId: checkOut tags: [attendance] summary: Clock-out dengan foto dan GPS requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CheckOutInput" responses: "200": description: Check-out berhasil content: application/json: schema: $ref: "#/components/schemas/AttendanceRecord" "400": description: Gagal check-out content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /attendance/today: get: operationId: getTodayAttendance tags: [attendance] summary: Ambil catatan absensi hari ini responses: "200": description: Catatan hari ini (null jika belum absen) content: application/json: schema: nullable: true oneOf: - $ref: "#/components/schemas/AttendanceRecord" - type: "null" /attendance/cycle-summary: get: operationId: getCycleSummary tags: [attendance] summary: Rekap siklus aktif (7-6) parameters: - name: cycleStart in: query schema: type: string description: "Tanggal mulai siklus (YYYY-MM-DD), default siklus aktif" responses: "200": description: Ringkasan siklus content: application/json: schema: $ref: "#/components/schemas/CycleSummary" /attendance/history: get: operationId: getAttendanceHistory tags: [attendance] summary: Riwayat absensi per siklus parameters: - name: cycleStart in: query schema: type: string description: "Tanggal mulai siklus (YYYY-MM-DD)" responses: "200": description: Daftar catatan absensi content: application/json: schema: type: array items: $ref: "#/components/schemas/AttendanceRecord" /attendance/admin/all: get: operationId: getAdminAttendance tags: [attendance] summary: "[Admin] Semua catatan absensi" parameters: - name: cycleStart in: query schema: type: string - name: userId in: query schema: type: integer - name: date in: query schema: type: string responses: "200": description: Semua catatan absensi content: application/json: schema: type: array items: $ref: "#/components/schemas/AttendanceRecord" /attendance/admin/today: get: operationId: getAdminTodayAttendance tags: [attendance] summary: "[Admin] Absensi semua karyawan hari ini" responses: "200": description: Catatan absensi hari ini semua karyawan content: application/json: schema: $ref: "#/components/schemas/TodayAttendanceOverview" /leave: get: operationId: getMyLeaveRequests tags: [leave] summary: Daftar pengajuan izin saya parameters: - name: status in: query schema: type: string responses: "200": description: Daftar pengajuan izin content: application/json: schema: type: array items: $ref: "#/components/schemas/LeaveRequest" post: operationId: submitLeaveRequest tags: [leave] summary: Ajukan izin/cuti requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LeaveInput" responses: "201": description: Pengajuan berhasil content: application/json: schema: $ref: "#/components/schemas/LeaveRequest" /leave/admin: get: operationId: getAdminLeaveRequests tags: [leave] summary: "[Admin] Semua pengajuan izin" parameters: - name: status in: query schema: type: string - name: userId in: query schema: type: integer responses: "200": description: Semua pengajuan izin content: application/json: schema: type: array items: $ref: "#/components/schemas/LeaveRequest" /leave/{id}/approve: patch: operationId: approveLeave tags: [leave] summary: "[Admin] Setujui izin" parameters: - name: id in: path required: true schema: type: integer requestBody: content: application/json: schema: $ref: "#/components/schemas/AdminNoteInput" responses: "200": description: Izin disetujui content: application/json: schema: $ref: "#/components/schemas/LeaveRequest" /leave/{id}/reject: patch: operationId: rejectLeave tags: [leave] summary: "[Admin] Tolak izin" parameters: - name: id in: path required: true schema: type: integer requestBody: content: application/json: schema: $ref: "#/components/schemas/AdminNoteInput" responses: "200": description: Izin ditolak content: application/json: schema: $ref: "#/components/schemas/LeaveRequest" /users: get: operationId: getUsers tags: [users] summary: "[Admin] Daftar semua karyawan" parameters: - name: isActive in: query schema: type: boolean responses: "200": description: Daftar karyawan content: application/json: schema: type: array items: $ref: "#/components/schemas/UserProfile" /users/{id}: get: operationId: getUserById tags: [users] summary: "[Admin] Detail karyawan" parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Data karyawan content: application/json: schema: $ref: "#/components/schemas/UserProfile" patch: operationId: updateUser tags: [users] summary: "[Admin] Update data karyawan" parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateUserInput" responses: "200": description: Data karyawan diperbarui content: application/json: schema: $ref: "#/components/schemas/UserProfile" /users/{id}/reset-password: post: operationId: resetUserPassword tags: [users] summary: "[Admin] Reset password karyawan" parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ResetPasswordInput" responses: "200": description: Password berhasil direset content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /users/profile: patch: operationId: updateMyProfile tags: [users] summary: Update profil saya requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateProfileInput" responses: "200": description: Profil diperbarui content: application/json: schema: $ref: "#/components/schemas/UserProfile" /notifications: get: operationId: getNotifications tags: [notifications] summary: Daftar notifikasi saya parameters: - name: unreadOnly in: query schema: type: boolean responses: "200": description: Daftar notifikasi content: application/json: schema: type: array items: $ref: "#/components/schemas/NotificationItem" /notifications/{id}/read: patch: operationId: markNotificationRead tags: [notifications] summary: Tandai notifikasi sudah dibaca parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Notifikasi ditandai dibaca content: application/json: schema: $ref: "#/components/schemas/NotificationItem" /notifications/read-all: post: operationId: markAllNotificationsRead tags: [notifications] summary: Tandai semua notifikasi sudah dibaca responses: "200": description: Semua notifikasi ditandai dibaca content: application/json: schema: $ref: "#/components/schemas/MessageResponse" components: schemas: AdminNoteInput: type: object properties: adminNote: type: string ResetPasswordInput: type: object required: [newPassword] properties: newPassword: type: string HealthStatus: type: object required: [status] properties: status: type: string ErrorResponse: type: object required: [error] properties: error: type: string MessageResponse: type: object required: [message] properties: message: type: string LoginInput: type: object required: [identifier, password] properties: identifier: type: string password: type: string RegisterInput: type: object required: [name, email, password] properties: name: type: string email: type: string password: type: string phone: type: string AuthResult: type: object required: [user, message] properties: user: $ref: "#/components/schemas/UserProfile" message: type: string UserProfile: type: object required: [id, employeeId, name, email, role, jabatan, isActive, createdAt] properties: id: type: integer employeeId: type: string name: type: string email: type: string role: type: string jabatan: type: string nullable: true department: type: string nullable: true position: type: string nullable: true phone: type: string nullable: true isActive: type: boolean avatarUrl: type: string nullable: true createdAt: type: string UpdateUserInput: type: object properties: name: type: string jabatan: type: string department: type: string phone: type: string isActive: type: boolean UpdateProfileInput: type: object properties: name: type: string phone: type: string CheckInInput: type: object required: [selfieBase64, latitude, longitude] properties: selfieBase64: type: string latitude: type: number longitude: type: number accuracy: type: number notes: type: string CheckOutInput: type: object required: [selfieBase64, latitude, longitude] properties: selfieBase64: type: string latitude: type: number longitude: type: number accuracy: type: number notes: type: string AttendanceRecord: type: object required: [id, userId, date, status, createdAt] properties: id: type: integer userId: type: integer date: type: string checkInTime: type: string nullable: true checkOutTime: type: string nullable: true checkInSelfie: type: string nullable: true checkOutSelfie: type: string nullable: true checkInLat: type: number nullable: true checkInLng: type: number nullable: true checkInAccuracy: type: number nullable: true checkOutLat: type: number nullable: true checkOutLng: type: number nullable: true checkOutAccuracy: type: number nullable: true status: type: string latenessMinutes: type: integer nullable: true overtimeMinutes: type: integer nullable: true workMinutes: type: integer nullable: true cycleStart: type: string nullable: true cycleEnd: type: string nullable: true notes: type: string nullable: true createdAt: type: string user: $ref: "#/components/schemas/UserProfile" nullable: true CycleSummary: type: object required: [cycleStart, cycleEnd, cycleLabel, totalWorkMinutes, totalOvertimeMinutes, totalLatenessMinutes, permitDays, presentDays, lateDays, absentDays] properties: cycleStart: type: string cycleEnd: type: string cycleLabel: type: string totalWorkMinutes: type: integer totalOvertimeMinutes: type: integer totalLatenessMinutes: type: integer permitDays: type: integer presentDays: type: integer lateDays: type: integer absentDays: type: integer records: type: array items: $ref: "#/components/schemas/AttendanceRecord" LeaveInput: type: object required: [type, startDate, endDate, reason] properties: type: type: string startDate: type: string endDate: type: string reason: type: string attachmentBase64: type: string nullable: true LeaveRequest: type: object required: [id, userId, type, startDate, endDate, reason, status, createdAt] properties: id: type: integer userId: type: integer type: type: string startDate: type: string endDate: type: string reason: type: string status: type: string adminNote: type: string nullable: true rejectionReason: type: string nullable: true reviewedBy: type: integer nullable: true reviewedAt: type: string nullable: true attachmentBase64: type: string nullable: true createdAt: type: string user: $ref: "#/components/schemas/UserProfile" nullable: true TodayAttendanceOverview: type: object required: [date, totalEmployees, checkedIn, checkedOut, notYet, records] properties: date: type: string totalEmployees: type: integer checkedIn: type: integer checkedOut: type: integer notYet: type: integer records: type: array items: $ref: "#/components/schemas/AttendanceRecord" NotificationItem: type: object required: [id, userId, title, message, type, isRead, createdAt] properties: id: type: integer userId: type: integer title: type: string message: type: string type: type: string isRead: type: boolean createdAt: type: string