recipient saving
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
|
||||
import 'package:pshared/data/mapper/organization/bound.dart';
|
||||
import 'package:pshared/models/recipient/filter.dart';
|
||||
import 'package:pshared/models/recipient/recipient.dart';
|
||||
import 'package:pshared/models/recipient/status.dart';
|
||||
import 'package:pshared/models/recipient/type.dart';
|
||||
import 'package:pshared/provider/organizations.dart';
|
||||
import 'package:pshared/provider/template.dart';
|
||||
import 'package:pshared/service/recipient/service.dart';
|
||||
@@ -51,6 +53,20 @@ class RecipientsProvider extends GenericProvider<Recipient> {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<Recipient> create({
|
||||
required String name,
|
||||
required String email,
|
||||
}) async => createObject(
|
||||
_organizations.current.id,
|
||||
newRecipient(
|
||||
organizationRef: _organizations.current.id,
|
||||
email: email,
|
||||
name: name,
|
||||
status: RecipientStatus.ready,
|
||||
type: RecipientType.internal,
|
||||
).toDTO().toJson(),
|
||||
);
|
||||
|
||||
void updateProviders(OrganizationsProvider organizations) {
|
||||
_organizations = organizations;
|
||||
if (_organizations.isOrganizationSet) {
|
||||
|
||||
Reference in New Issue
Block a user