Add order entities and mocks for client order feature
Introduces new domain entities for order types and one-time orders, along with their positions. Adds a mock OrderRepository to the data_connect package and wires it into the module. Updates localization files for new order flows and refactors Equatable usage for consistency. Also adds a minus icon to the design system.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
///
|
||||
/// TODO: These mocks currently do not implement any specific interfaces.
|
||||
/// They will implement interfaces defined in feature packages once those are created.
|
||||
library;
|
||||
|
||||
export 'src/mocks/auth_repository_mock.dart';
|
||||
export 'src/mocks/staff_repository_mock.dart';
|
||||
@@ -15,6 +16,7 @@ export 'src/mocks/rating_repository_mock.dart';
|
||||
export 'src/mocks/support_repository_mock.dart';
|
||||
export 'src/mocks/home_repository_mock.dart';
|
||||
export 'src/mocks/business_repository_mock.dart';
|
||||
export 'src/mocks/order_repository_mock.dart';
|
||||
export 'src/data_connect_module.dart';
|
||||
|
||||
// Export the generated Data Connect SDK
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'mocks/auth_repository_mock.dart';
|
||||
import 'mocks/business_repository_mock.dart';
|
||||
import 'mocks/home_repository_mock.dart';
|
||||
import 'mocks/order_repository_mock.dart';
|
||||
|
||||
/// A module that provides Data Connect dependencies, including mocks.
|
||||
class DataConnectModule extends Module {
|
||||
@@ -11,5 +12,6 @@ class DataConnectModule extends Module {
|
||||
i.addLazySingleton(AuthRepositoryMock.new);
|
||||
i.addLazySingleton(HomeRepositoryMock.new);
|
||||
i.addLazySingleton(BusinessRepositoryMock.new);
|
||||
i.addLazySingleton(OrderRepositoryMock.new);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class BusinessRepositoryMock {
|
||||
|
||||
Future<List<Hub>> getHubs(String businessId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return [
|
||||
return <Hub>[
|
||||
const Hub(
|
||||
id: 'hub_1',
|
||||
businessId: 'biz_1',
|
||||
|
||||
@@ -19,7 +19,7 @@ class EventRepositoryMock {
|
||||
|
||||
Future<List<EventShift>> getEventShifts(String eventId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return [
|
||||
return <EventShift>[
|
||||
const EventShift(
|
||||
id: 'shift_1',
|
||||
eventId: 'event_1',
|
||||
@@ -31,7 +31,7 @@ class EventRepositoryMock {
|
||||
|
||||
Future<List<Assignment>> getStaffAssignments(String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return [
|
||||
return <Assignment>[
|
||||
const Assignment(
|
||||
id: 'assign_1',
|
||||
positionId: 'pos_1',
|
||||
@@ -43,10 +43,10 @@ class EventRepositoryMock {
|
||||
|
||||
Future<List<Event>> getUpcomingEvents() async {
|
||||
await Future.delayed(const Duration(milliseconds: 800));
|
||||
return [_mockEvent];
|
||||
return <Event>[_mockEvent];
|
||||
}
|
||||
|
||||
static final _mockEvent = Event(
|
||||
static final Event _mockEvent = Event(
|
||||
id: 'event_1',
|
||||
businessId: 'biz_1',
|
||||
hubId: 'hub_1',
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
class FinancialRepositoryMock {
|
||||
Future<List<Invoice>> getInvoices(String businessId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return [
|
||||
return <Invoice>[
|
||||
const Invoice(
|
||||
id: 'inv_1',
|
||||
eventId: 'event_1',
|
||||
@@ -19,7 +19,7 @@ class FinancialRepositoryMock {
|
||||
|
||||
Future<List<StaffPayment>> getStaffPayments(String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return [
|
||||
return <StaffPayment>[
|
||||
StaffPayment(
|
||||
id: 'pay_1',
|
||||
staffId: staffId,
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
/// Mock implementation of order-related data operations.
|
||||
///
|
||||
/// This class simulates backend responses for order types and order creation.
|
||||
/// It is used by the feature-level repository implementations.
|
||||
class OrderRepositoryMock {
|
||||
/// Returns a list of available [OrderType]s.
|
||||
Future<List<OrderType>> getOrderTypes() async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return const <OrderType>[
|
||||
OrderType(
|
||||
id: 'rapid',
|
||||
titleKey: 'client_create_order.types.rapid',
|
||||
descriptionKey: 'client_create_order.types.rapid_desc',
|
||||
),
|
||||
OrderType(
|
||||
id: 'one-time',
|
||||
titleKey: 'client_create_order.types.one_time',
|
||||
descriptionKey: 'client_create_order.types.one_time_desc',
|
||||
),
|
||||
OrderType(
|
||||
id: 'recurring',
|
||||
titleKey: 'client_create_order.types.recurring',
|
||||
descriptionKey: 'client_create_order.types.recurring_desc',
|
||||
),
|
||||
OrderType(
|
||||
id: 'permanent',
|
||||
titleKey: 'client_create_order.types.permanent',
|
||||
descriptionKey: 'client_create_order.types.permanent_desc',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/// Simulates creating a one-time order.
|
||||
Future<void> createOneTimeOrder(OneTimeOrder order) async {
|
||||
await Future.delayed(const Duration(milliseconds: 800));
|
||||
}
|
||||
|
||||
/// Simulates creating a rapid order.
|
||||
Future<void> createRapidOrder(String description) async {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
class RatingRepositoryMock {
|
||||
Future<List<StaffRating>> getStaffRatings(String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 400));
|
||||
return [
|
||||
return <StaffRating>[
|
||||
const StaffRating(
|
||||
id: 'rate_1',
|
||||
staffId: 'staff_1',
|
||||
|
||||
@@ -8,7 +8,7 @@ class SkillRepositoryMock {
|
||||
|
||||
Future<List<Skill>> getAllSkills() async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return [
|
||||
return <Skill>[
|
||||
const Skill(
|
||||
id: 'skill_1',
|
||||
categoryId: 'cat_1',
|
||||
@@ -26,7 +26,7 @@ class SkillRepositoryMock {
|
||||
|
||||
Future<List<StaffSkill>> getStaffSkills(String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 400));
|
||||
return [
|
||||
return <StaffSkill>[
|
||||
const StaffSkill(
|
||||
id: 'staff_skill_1',
|
||||
staffId: 'staff_1',
|
||||
|
||||
@@ -9,7 +9,7 @@ class StaffRepositoryMock {
|
||||
|
||||
Future<List<Membership>> getMemberships(String userId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return [
|
||||
return <Membership>[
|
||||
Membership(
|
||||
id: 'mem_1',
|
||||
userId: userId,
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
class SupportRepositoryMock {
|
||||
Future<List<Tag>> getTags() async {
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
return [
|
||||
return <Tag>[
|
||||
const Tag(id: 'tag_1', label: 'Urgent'),
|
||||
const Tag(id: 'tag_2', label: 'VIP Event'),
|
||||
];
|
||||
@@ -12,7 +12,7 @@ class SupportRepositoryMock {
|
||||
|
||||
Future<List<WorkingArea>> getWorkingAreas() async {
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
return [
|
||||
return <WorkingArea>[
|
||||
const WorkingArea(
|
||||
id: 'area_1',
|
||||
name: 'Central London',
|
||||
|
||||
Reference in New Issue
Block a user