chore: restore stashed work - new order usecases and domain entities
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'permanent_order_position.dart';
|
||||
import 'one_time_order.dart';
|
||||
import 'one_time_order_position.dart';
|
||||
|
||||
/// Represents a permanent staffing request spanning a date range.
|
||||
/// Represents a customer's request for permanent/ongoing staffing.
|
||||
class PermanentOrder extends Equatable {
|
||||
const PermanentOrder({
|
||||
required this.startDate,
|
||||
required this.permanentDays,
|
||||
required this.location,
|
||||
required this.positions,
|
||||
this.hub,
|
||||
this.eventName,
|
||||
@@ -14,35 +14,21 @@ class PermanentOrder extends Equatable {
|
||||
this.roleRates = const <String, double>{},
|
||||
});
|
||||
|
||||
/// Start date for the permanent schedule.
|
||||
final DateTime startDate;
|
||||
|
||||
/// Days of the week to repeat on (e.g., ["SUN", "MON", ...]).
|
||||
|
||||
/// List of days (e.g., ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'])
|
||||
final List<String> permanentDays;
|
||||
|
||||
/// The primary location where the work will take place.
|
||||
final String location;
|
||||
|
||||
/// The list of positions and headcounts required for this order.
|
||||
final List<PermanentOrderPosition> positions;
|
||||
|
||||
/// Selected hub details for this order.
|
||||
final PermanentOrderHubDetails? hub;
|
||||
|
||||
/// Optional order name.
|
||||
|
||||
final List<OneTimeOrderPosition> positions;
|
||||
final OneTimeOrderHubDetails? hub;
|
||||
final String? eventName;
|
||||
|
||||
/// Selected vendor id for this order.
|
||||
final String? vendorId;
|
||||
|
||||
/// Role hourly rates keyed by role id.
|
||||
final Map<String, double> roleRates;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[
|
||||
List<Object?> get props => [
|
||||
startDate,
|
||||
permanentDays,
|
||||
location,
|
||||
positions,
|
||||
hub,
|
||||
eventName,
|
||||
@@ -50,47 +36,3 @@ class PermanentOrder extends Equatable {
|
||||
roleRates,
|
||||
];
|
||||
}
|
||||
|
||||
/// Minimal hub details used during permanent order creation.
|
||||
class PermanentOrderHubDetails extends Equatable {
|
||||
const PermanentOrderHubDetails({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.address,
|
||||
this.placeId,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.city,
|
||||
this.state,
|
||||
this.street,
|
||||
this.country,
|
||||
this.zipCode,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String name;
|
||||
final String address;
|
||||
final String? placeId;
|
||||
final double? latitude;
|
||||
final double? longitude;
|
||||
final String? city;
|
||||
final String? state;
|
||||
final String? street;
|
||||
final String? country;
|
||||
final String? zipCode;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
name,
|
||||
address,
|
||||
placeId,
|
||||
latitude,
|
||||
longitude,
|
||||
city,
|
||||
state,
|
||||
street,
|
||||
country,
|
||||
zipCode,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
<<<<<<< Updated upstream
|
||||
import 'recurring_order_position.dart';
|
||||
|
||||
/// Represents a recurring staffing request spanning a date range.
|
||||
=======
|
||||
import 'one_time_order.dart';
|
||||
import 'one_time_order_position.dart';
|
||||
|
||||
/// Represents a customer's request for recurring staffing.
|
||||
>>>>>>> Stashed changes
|
||||
class RecurringOrder extends Equatable {
|
||||
const RecurringOrder({
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
required this.recurringDays,
|
||||
<<<<<<< Updated upstream
|
||||
required this.location,
|
||||
=======
|
||||
>>>>>>> Stashed changes
|
||||
required this.positions,
|
||||
this.hub,
|
||||
this.eventName,
|
||||
@@ -15,6 +25,7 @@ class RecurringOrder extends Equatable {
|
||||
this.roleRates = const <String, double>{},
|
||||
});
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
/// Start date for the recurring schedule.
|
||||
final DateTime startDate;
|
||||
|
||||
@@ -48,6 +59,25 @@ class RecurringOrder extends Equatable {
|
||||
endDate,
|
||||
recurringDays,
|
||||
location,
|
||||
=======
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
|
||||
/// List of days (e.g., ['Monday', 'Wednesday']) or bitmask.
|
||||
final List<String> recurringDays;
|
||||
|
||||
final List<OneTimeOrderPosition> positions;
|
||||
final OneTimeOrderHubDetails? hub;
|
||||
final String? eventName;
|
||||
final String? vendorId;
|
||||
final Map<String, double> roleRates;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
startDate,
|
||||
endDate,
|
||||
recurringDays,
|
||||
>>>>>>> Stashed changes
|
||||
positions,
|
||||
hub,
|
||||
eventName,
|
||||
@@ -55,6 +85,7 @@ class RecurringOrder extends Equatable {
|
||||
roleRates,
|
||||
];
|
||||
}
|
||||
<<<<<<< Updated upstream
|
||||
|
||||
/// Minimal hub details used during recurring order creation.
|
||||
class RecurringOrderHubDetails extends Equatable {
|
||||
@@ -99,3 +130,5 @@ class RecurringOrderHubDetails extends Equatable {
|
||||
zipCode,
|
||||
];
|
||||
}
|
||||
=======
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import 'package:krow_core/core.dart';
|
||||
import '../arguments/permanent_order_arguments.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../repositories/client_create_order_repository_interface.dart';
|
||||
|
||||
/// Use case for creating a permanent staffing order.
|
||||
class CreatePermanentOrderUseCase
|
||||
implements UseCase<PermanentOrderArguments, void> {
|
||||
/// Creates a [CreatePermanentOrderUseCase].
|
||||
class CreatePermanentOrderUseCase implements UseCase<Future<void>, PermanentOrder> {
|
||||
const CreatePermanentOrderUseCase(this._repository);
|
||||
|
||||
final ClientCreateOrderRepositoryInterface _repository;
|
||||
|
||||
@override
|
||||
Future<void> call(PermanentOrderArguments input) {
|
||||
return _repository.createPermanentOrder(input.order);
|
||||
Future<void> call(PermanentOrder params) {
|
||||
return _repository.createPermanentOrder(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import 'package:krow_core/core.dart';
|
||||
import '../arguments/recurring_order_arguments.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../repositories/client_create_order_repository_interface.dart';
|
||||
|
||||
/// Use case for creating a recurring staffing order.
|
||||
class CreateRecurringOrderUseCase
|
||||
implements UseCase<RecurringOrderArguments, void> {
|
||||
/// Creates a [CreateRecurringOrderUseCase].
|
||||
class CreateRecurringOrderUseCase implements UseCase<Future<void>, RecurringOrder> {
|
||||
const CreateRecurringOrderUseCase(this._repository);
|
||||
|
||||
final ClientCreateOrderRepositoryInterface _repository;
|
||||
|
||||
@override
|
||||
Future<void> call(RecurringOrderArguments input) {
|
||||
return _repository.createRecurringOrder(input.order);
|
||||
Future<void> call(RecurringOrder params) {
|
||||
return _repository.createRecurringOrder(params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user