a85890f30a
- mobile/: Flutter/Dart merchant mobile app skeleton - .github/: GitHub Actions CI workflows - .dockerignore: exclude host node_modules from build context - .cursorrules: Cursor IDE project rules - .claude/: Claude Code project settings and launch config Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
56 lines
1.3 KiB
Dart
56 lines
1.3 KiB
Dart
import 'package:dio/dio.dart';
|
|
|
|
import '../../core/api/api_client.dart';
|
|
|
|
class HrApi {
|
|
HrApi(this._client);
|
|
|
|
final ApiClient _client;
|
|
|
|
Future<Map<String, dynamic>?> fetchTodayShift({
|
|
required String cafeId,
|
|
required String employeeId,
|
|
}) async {
|
|
final res = await _client.dio.get<Map<String, dynamic>>(
|
|
'/api/cafes/$cafeId/employees/$employeeId/shift/today',
|
|
);
|
|
final data = res.data?['data'] as Map<String, dynamic>?;
|
|
return data;
|
|
}
|
|
|
|
Future<void> clockIn({
|
|
required String cafeId,
|
|
required String employeeId,
|
|
}) async {
|
|
await _client.dio.post(
|
|
'/api/cafes/$cafeId/employees/$employeeId/attendance/clock-in',
|
|
);
|
|
}
|
|
|
|
Future<void> clockOut({
|
|
required String cafeId,
|
|
required String employeeId,
|
|
}) async {
|
|
await _client.dio.post(
|
|
'/api/cafes/$cafeId/employees/$employeeId/attendance/clock-out',
|
|
);
|
|
}
|
|
|
|
Future<void> submitLeave({
|
|
required String cafeId,
|
|
required String employeeId,
|
|
required String startDate,
|
|
required String endDate,
|
|
String? reason,
|
|
}) async {
|
|
await _client.dio.post(
|
|
'/api/cafes/$cafeId/employees/$employeeId/leave-requests',
|
|
data: {
|
|
'startDate': startDate,
|
|
'endDate': endDate,
|
|
if (reason != null && reason.isNotEmpty) 'reason': reason,
|
|
},
|
|
);
|
|
}
|
|
}
|