create submission

This commit is contained in:
Phuoc Nguyen
2025-11-27 16:56:01 +07:00
parent ba04576750
commit b6cb9e865a
18 changed files with 1445 additions and 138 deletions

View File

@@ -0,0 +1,35 @@
/// Project Progress Entity
///
/// Represents a construction progress stage from the API.
/// Used for dropdown selection when creating/updating project submissions.
library;
import 'package:equatable/equatable.dart';
/// Project Progress Entity
///
/// Contains construction progress stages:
/// - Chưa khởi công (Not started)
/// - Khởi công móng (Foundation started)
/// - Đang phần thô (Rough construction)
/// - Đang hoàn thiện (Finishing)
/// - Cất nóc (Roofing complete)
/// - Hoàn thiện (Completed)
class ProjectProgress extends Equatable {
/// Unique identifier (API: name)
final String id;
/// Progress status label in Vietnamese (API: status)
final String status;
const ProjectProgress({
required this.id,
required this.status,
});
@override
List<Object?> get props => [id, status];
@override
String toString() => 'ProjectProgress(id: $id, status: $status)';
}

View File

@@ -3,6 +3,8 @@
/// Repository interface for project submissions operations.
library;
import 'package:worker/features/projects/data/models/project_submission_request.dart';
import 'package:worker/features/projects/domain/entities/project_progress.dart';
import 'package:worker/features/projects/domain/entities/project_status.dart';
import 'package:worker/features/projects/domain/entities/project_submission.dart';
@@ -20,9 +22,32 @@ abstract class SubmissionsRepository {
bool forceRefresh = false,
});
/// Get list of construction progress stages
///
/// Uses cache-first pattern:
/// - Returns cached data if available
/// - Fetches from API and updates cache
/// - [forceRefresh] bypasses cache and fetches fresh data
Future<List<ProjectProgress>> getProjectProgressList({
bool forceRefresh = false,
});
/// Get all project submissions for the current user
Future<List<ProjectSubmission>> getSubmissions({
int limitStart = 0,
int limitPageLength = 0,
});
/// Save (create/update) a project submission
/// Returns the project name (ID) from the API response
Future<String> saveSubmission(ProjectSubmissionRequest request);
/// Upload a file for a project submission
/// [projectName] is the project ID returned from saveSubmission
/// [filePath] is the local path to the file
/// Returns the uploaded file URL
Future<String> uploadProjectFile({
required String projectName,
required String filePath,
});
}