initalizing the mobile apps
This commit is contained in:
17
apps/packages/data_connect/lib/krow_data_connect.dart
Normal file
17
apps/packages/data_connect/lib/krow_data_connect.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
/// The Data Connect layer.
|
||||
///
|
||||
/// This package provides mock implementations of domain repository interfaces
|
||||
/// for development and testing purposes.
|
||||
///
|
||||
/// TODO: These mocks currently do not implement any specific interfaces.
|
||||
/// They will implement interfaces defined in feature packages once those are created.
|
||||
|
||||
export 'src/mocks/auth_repository_mock.dart';
|
||||
export 'src/mocks/staff_repository_mock.dart';
|
||||
export 'src/mocks/business_repository_mock.dart';
|
||||
export 'src/mocks/event_repository_mock.dart';
|
||||
export 'src/mocks/skill_repository_mock.dart';
|
||||
export 'src/mocks/financial_repository_mock.dart';
|
||||
export 'src/mocks/rating_repository_mock.dart';
|
||||
export 'src/mocks/support_repository_mock.dart';
|
||||
export 'src/data_connect_module.dart';
|
||||
11
apps/packages/data_connect/lib/src/data_connect_module.dart
Normal file
11
apps/packages/data_connect/lib/src/data_connect_module.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'mocks/auth_repository_mock.dart';
|
||||
|
||||
/// A module that provides Data Connect dependencies, including mocks.
|
||||
class DataConnectModule extends Module {
|
||||
@override
|
||||
void exportedBinds(Injector i) {
|
||||
// Make the AuthRepositoryMock available to any module that imports this one.
|
||||
i.addLazySingleton(AuthRepositoryMock.new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
// TODO: Implement AuthRepositoryInterface once defined in a feature package.
|
||||
class AuthRepositoryMock {
|
||||
Stream<User?> get currentUser => Stream.value(
|
||||
const User(id: 'mock_user_1', email: 'test@krow.com', role: 'staff'),
|
||||
);
|
||||
|
||||
Future<String?> signInWithPhone(String phoneNumber) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return 'mock_verification_id';
|
||||
}
|
||||
|
||||
Future<User?> verifyOtp(String verificationId, String smsCode) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return const User(id: 'mock_user_1', email: 'test@krow.com', role: 'staff');
|
||||
}
|
||||
|
||||
Future<void> signOut() async {
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
}
|
||||
|
||||
/// Signs in a user with email and password (Mock).
|
||||
Future<User> signInWithEmail(String email, String password) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return User(id: 'mock_client_1', email: email, role: 'client_admin');
|
||||
}
|
||||
|
||||
/// Registers a new user with email and password (Mock).
|
||||
Future<User> signUpWithEmail(
|
||||
String email,
|
||||
String password,
|
||||
String companyName,
|
||||
) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return User(id: 'mock_client_new', email: email, role: 'client_admin');
|
||||
}
|
||||
|
||||
/// Authenticates using a social provider (Mock).
|
||||
Future<User> signInWithSocial(String provider) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return const User(
|
||||
id: 'mock_social_user',
|
||||
email: 'social@example.com',
|
||||
role: 'client_admin',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
// TODO: Implement BusinessRepositoryInterface once defined in a feature package.
|
||||
class BusinessRepositoryMock {
|
||||
Future<Business?> getBusiness(String id) async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return const Business(
|
||||
id: 'biz_1',
|
||||
name: 'Acme Events Ltd',
|
||||
registrationNumber: 'REG123456',
|
||||
status: BusinessStatus.active,
|
||||
avatar: 'https://via.placeholder.com/150',
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<Hub>> getHubs(String businessId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return [
|
||||
const Hub(
|
||||
id: 'hub_1',
|
||||
businessId: 'biz_1',
|
||||
name: 'London HQ',
|
||||
address: '123 Oxford Street, London',
|
||||
status: HubStatus.active,
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
// TODO: Implement EventRepositoryInterface once defined in a feature package.
|
||||
class EventRepositoryMock {
|
||||
Future<Assignment> applyForPosition(String positionId, String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 600));
|
||||
return Assignment(
|
||||
id: 'assign_1',
|
||||
positionId: positionId,
|
||||
staffId: staffId,
|
||||
status: AssignmentStatus.assigned,
|
||||
);
|
||||
}
|
||||
|
||||
Future<Event?> getEvent(String id) async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return _mockEvent;
|
||||
}
|
||||
|
||||
Future<List<EventShift>> getEventShifts(String eventId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return [
|
||||
const EventShift(
|
||||
id: 'shift_1',
|
||||
eventId: 'event_1',
|
||||
name: 'Morning Setup',
|
||||
address: 'Hyde Park, London',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<List<Assignment>> getStaffAssignments(String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return [
|
||||
const Assignment(
|
||||
id: 'assign_1',
|
||||
positionId: 'pos_1',
|
||||
staffId: 'staff_1',
|
||||
status: AssignmentStatus.confirmed,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<List<Event>> getUpcomingEvents() async {
|
||||
await Future.delayed(const Duration(milliseconds: 800));
|
||||
return [_mockEvent];
|
||||
}
|
||||
|
||||
static final _mockEvent = Event(
|
||||
id: 'event_1',
|
||||
businessId: 'biz_1',
|
||||
hubId: 'hub_1',
|
||||
name: 'Summer Festival 2026',
|
||||
date: DateTime.now().add(const Duration(days: 10)),
|
||||
status: EventStatus.active,
|
||||
contractType: 'freelance',
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
// TODO: Implement FinancialRepositoryInterface once defined in a feature package.
|
||||
class FinancialRepositoryMock {
|
||||
Future<List<Invoice>> getInvoices(String businessId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return [
|
||||
const Invoice(
|
||||
id: 'inv_1',
|
||||
eventId: 'event_1',
|
||||
businessId: 'biz_1',
|
||||
status: InvoiceStatus.paid,
|
||||
totalAmount: 1500.0,
|
||||
workAmount: 1400.0,
|
||||
addonsAmount: 100.0,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<List<StaffPayment>> getStaffPayments(String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return [
|
||||
StaffPayment(
|
||||
id: 'pay_1',
|
||||
staffId: staffId,
|
||||
assignmentId: 'assign_1',
|
||||
amount: 120.0,
|
||||
status: PaymentStatus.paid,
|
||||
paidAt: DateTime.now().subtract(const Duration(days: 2)),
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
// TODO: Implement RatingRepositoryInterface once defined in a feature package.
|
||||
class RatingRepositoryMock {
|
||||
Future<List<StaffRating>> getStaffRatings(String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 400));
|
||||
return [
|
||||
const StaffRating(
|
||||
id: 'rate_1',
|
||||
staffId: 'staff_1',
|
||||
eventId: 'event_1',
|
||||
businessId: 'biz_1',
|
||||
rating: 5,
|
||||
comment: 'Great work!',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<void> submitRating(StaffRating rating) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
// TODO: Implement SkillRepositoryInterface once defined in a feature package.
|
||||
class SkillRepositoryMock {
|
||||
Future<void> addStaffSkill(StaffSkill skill) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
}
|
||||
|
||||
Future<List<Skill>> getAllSkills() async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return [
|
||||
const Skill(
|
||||
id: 'skill_1',
|
||||
categoryId: 'cat_1',
|
||||
name: 'Bartender',
|
||||
basePrice: 15.0,
|
||||
),
|
||||
const Skill(
|
||||
id: 'skill_2',
|
||||
categoryId: 'cat_2',
|
||||
name: 'Security Guard',
|
||||
basePrice: 18.0,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<List<StaffSkill>> getStaffSkills(String staffId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 400));
|
||||
return [
|
||||
const StaffSkill(
|
||||
id: 'staff_skill_1',
|
||||
staffId: 'staff_1',
|
||||
skillId: 'skill_1',
|
||||
level: SkillLevel.skilled,
|
||||
experienceYears: 3,
|
||||
status: StaffSkillStatus.verified,
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
// TODO: Implement StaffRepositoryInterface once defined in a feature package.
|
||||
class StaffRepositoryMock {
|
||||
Future<Staff> createStaffProfile(Staff staff) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return staff;
|
||||
}
|
||||
|
||||
Future<List<Membership>> getMemberships(String userId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
return [
|
||||
Membership(
|
||||
id: 'mem_1',
|
||||
userId: userId,
|
||||
memberableId: 'biz_1',
|
||||
memberableType: 'business',
|
||||
role: 'staff',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<Staff?> getStaffProfile(String userId) async {
|
||||
await Future.delayed(const Duration(milliseconds: 400));
|
||||
return Staff(
|
||||
id: 'staff_1',
|
||||
authProviderId: userId,
|
||||
name: 'John Doe',
|
||||
email: 'john@krow.com',
|
||||
status: StaffStatus.active,
|
||||
avatar: 'https://i.pravatar.cc/300',
|
||||
);
|
||||
}
|
||||
|
||||
Future<Staff> updateStaffProfile(Staff staff) async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return staff;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
// TODO: Implement SupportRepositoryInterface once defined in a feature package.
|
||||
class SupportRepositoryMock {
|
||||
Future<List<Tag>> getTags() async {
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
return [
|
||||
const Tag(id: 'tag_1', label: 'Urgent'),
|
||||
const Tag(id: 'tag_2', label: 'VIP Event'),
|
||||
];
|
||||
}
|
||||
|
||||
Future<List<WorkingArea>> getWorkingAreas() async {
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
return [
|
||||
const WorkingArea(
|
||||
id: 'area_1',
|
||||
name: 'Central London',
|
||||
centerLat: 51.5074,
|
||||
centerLng: -0.1278,
|
||||
radiusKm: 10.0,
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
16
apps/packages/data_connect/pubspec.yaml
Normal file
16
apps/packages/data_connect/pubspec.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
name: krow_data_connect
|
||||
description: Firebase Data Connect access layer.
|
||||
version: 0.0.1
|
||||
publish_to: none
|
||||
resolution: workspace
|
||||
|
||||
environment:
|
||||
sdk: '>=3.10.0 <4.0.0'
|
||||
flutter: ">=3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
krow_domain:
|
||||
path: ../domain
|
||||
flutter_modular: ^6.3.0
|
||||
Reference in New Issue
Block a user