Temporary fix on date/data payment
This commit is contained in:
@@ -18,7 +18,10 @@ const auth = getAuth(app);
|
||||
|
||||
export default withIronSessionApiRoute(handler, sessionOptions);
|
||||
|
||||
const addPaymentRecord = async (data: Payment) => {
|
||||
// TODO: Data is set as any as data cannot be parsed to Payment
|
||||
// because the id is not a par of the hash and payment expects date to be of type Date
|
||||
// but if it is not inserted as a string, some UI components will not work (Invalid Date)
|
||||
const addPaymentRecord = async (data: any) => {
|
||||
const shortUID = new ShortUniqueId();
|
||||
await setDoc(doc(db, "payments", shortUID.randomUUID(8)), data);
|
||||
}
|
||||
@@ -33,8 +36,8 @@ const managePaymentRecords = async (user: User, userId: string | undefined): Pro
|
||||
currency: user.corporateInformation.payment!.currency,
|
||||
value: user.corporateInformation.payment!.value,
|
||||
isPaid: false,
|
||||
date: new Date(),
|
||||
} as Payment;
|
||||
date: new Date().toISOString(),
|
||||
};
|
||||
|
||||
const corporatePayments = await getDocs(query(collection(db, "payments"), where("corporate", "==", userId)));
|
||||
if(corporatePayments.docs.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user