Skip to content

Commit

Permalink
chore(recipients-app): Remove redundant update by and at fields from …
Browse files Browse the repository at this point in the history
…recipient and payment (#648)

* Remove redundant update by and at fields from recipient and payment

* Revert removal of updated_by

* Cleanup code
  • Loading branch information
MDikkii authored Dec 1, 2023
1 parent c930f82 commit 64156d9
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ class SocialIncomePayment extends Equatable {
@JsonKey(name: "last_updated_by")
final String? updatedBy;

@JsonKey(name: "last_updated_at")
final Timestamp? updatedAt;

const SocialIncomePayment({
required this.id,
this.amount,
Expand All @@ -32,7 +29,6 @@ class SocialIncomePayment extends Equatable {
this.status,
this.comments,
this.updatedBy,
this.updatedAt,
});

factory SocialIncomePayment.fromJson(Map<String, dynamic> json) =>
Expand All @@ -50,7 +46,6 @@ class SocialIncomePayment extends Equatable {
status,
comments,
updatedBy,
updatedAt,
];
}

Expand All @@ -62,7 +57,6 @@ class SocialIncomePayment extends Equatable {
String? currency,
PaymentStatus? status,
String? updatedBy,
Timestamp? updatedAt,
}) {
return SocialIncomePayment(
id: id ?? this.id,
Expand All @@ -72,7 +66,6 @@ class SocialIncomePayment extends Equatable {
currency: currency ?? this.currency,
status: status ?? this.status,
updatedBy: updatedBy ?? this.updatedBy,
updatedAt: updatedAt ?? this.updatedAt,
);
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions recipients_app/lib/data/repositories/payment_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import "package:app/data/repositories/repositories.dart";
import "package:cloud_firestore/cloud_firestore.dart";

const String paymentCollection = "payments";
const String kUpdatedByAppUser = "app user";

class PaymentRepository {
final FirebaseFirestore firestore;
Expand Down Expand Up @@ -46,7 +45,6 @@ class PaymentRepository {
final updatedPayment = payment.copyWith(
status: PaymentStatus.confirmed,
updatedBy: "${recipient.userId}",
updatedAt: Timestamp.now(),
);

await firestore
Expand All @@ -66,7 +64,6 @@ class PaymentRepository {
status: PaymentStatus.contested,
comments: contestReason,
updatedBy: "${recipient.userId}",
updatedAt: Timestamp.now(),
);

await firestore
Expand Down
2 changes: 1 addition & 1 deletion recipients_app/lib/data/repositories/user_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class UserRepository {
firebaseAuth.signInWithCredential(credentials);

Future<void> updateRecipient(Recipient recipient) async {
final updatedRecipient = recipient.copyWith(updatedBy: kUpdatedByAppUser);
final updatedRecipient = recipient.copyWith(updatedBy: "${recipient.userId}");

return firestore
.collection(recipientCollection)
Expand Down

0 comments on commit 64156d9

Please sign in to comment.