-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: improve sorting * Update emulator data * Add progress indicator at the end of expense list * Add expenses cubit tests * Test loading number of expenses divisible by page size * Improve expenses loading state * WIP: implement expense filtering * Refactor expenses cubit * Style processing state * Fix filter state after loading more * Revert adding 15 expenses * Add finalizable expense to import data * Improve scroll behaviour * Fix functions and add updater * Undo multiadd * Fix variable redeclaration * Fix all tests * Update emulator test data * WIP: create userExpense * Introduce UserExpense * Simplify user expense definition * Remove UserExpense * Add data synchronizer * Fix unit tests * Fix integration tests * Uncomment more tests * Remove wrong testing data
- Loading branch information
Showing
49 changed files
with
869 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"7IE7Zua6OBqK4YEGiF61TMo9agHL","createdAt":"1654454042657","lastLoginAt":"1654454253238","displayName":"Third","photoUrl":"https://picsum.photos/300","passwordHash":"fakeHash:salt=fakeSaltESg0Rz1lsdgpiaOAJOL5:password=Qweqwe1!","salt":"fakeSaltESg0Rz1lsdgpiaOAJOL5","passwordUpdatedAt":1695944415918,"providerUserInfo":[{"providerId":"password","email":"third@example.com","federatedId":"third@example.com","rawId":"third@example.com","displayName":"Third","photoUrl":"https://picsum.photos/300"}],"validSince":"1695944415","email":"third@example.com","emailVerified":false,"disabled":false},{"localId":"92HncVCBiegd6rJP0Vt1gjVPz2cM","createdAt":"1650417583240","lastLoginAt":"1695944471554","displayName":"Tester","photoUrl":"https://picsum.photos/200","passwordHash":"fakeHash:salt=fakeSaltIiD2sStkbTThNgabfTRB:password=Qweqwe1!","salt":"fakeSaltIiD2sStkbTThNgabfTRB","passwordUpdatedAt":1695944415918,"providerUserInfo":[{"providerId":"password","email":"user@example.com","federatedId":"user@example.com","rawId":"user@example.com","displayName":"Tester","photoUrl":"https://picsum.photos/200"}],"validSince":"1695944415","email":"user@example.com","emailVerified":false,"disabled":false,"lastRefreshAt":"2023-09-28T23:41:11.554Z"},{"localId":"Sp0Vj5sxPqxhigfcEcMhLjBABKys","createdAt":"1650417747662","lastLoginAt":"1695696494701","displayName":"Admin","photoUrl":"https://picsum.photos/100","passwordHash":"fakeHash:salt=fakeSalteQRBxA7ZoPpuLT6a4FpJ:password=Qweqwe1!","salt":"fakeSalteQRBxA7ZoPpuLT6a4FpJ","passwordUpdatedAt":1695944415918,"providerUserInfo":[{"providerId":"password","email":"admin@example.com","federatedId":"admin@example.com","rawId":"admin@example.com","displayName":"Admin","photoUrl":"https://picsum.photos/100"}],"validSince":"1695944415","email":"admin@example.com","emailVerified":false,"disabled":false},{"localId":"bqWC1RRnBBncEDJjb0qqq9q7lQUr","createdAt":"1695696328310","lastLoginAt":"1695696444840","displayName":"John Doe","photoUrl":"https://picsum.photos/id/22/100","passwordHash":"fakeHash:salt=fakeSaltCIpVFXmFNFHBXP9yUoXk:password=Qweqwe1!","salt":"fakeSaltCIpVFXmFNFHBXP9yUoXk","passwordUpdatedAt":1695944415918,"providerUserInfo":[{"providerId":"password","email":"j.doe@example.com","federatedId":"j.doe@example.com","rawId":"j.doe@example.com","displayName":"John Doe","photoUrl":"https://picsum.photos/id/22/100"}],"validSince":"1695944415","email":"j.doe@example.com","emailVerified":false,"disabled":false}]} | ||
{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"7IE7Zua6OBqK4YEGiF61TMo9agHL","createdAt":"1654454042657","lastLoginAt":"1654454253238","displayName":"Third","photoUrl":"https://picsum.photos/300","passwordHash":"fakeHash:salt=fakeSaltESg0Rz1lsdgpiaOAJOL5:password=Qweqwe1!","salt":"fakeSaltESg0Rz1lsdgpiaOAJOL5","passwordUpdatedAt":1698195790521,"providerUserInfo":[{"providerId":"password","email":"third@example.com","federatedId":"third@example.com","rawId":"third@example.com","displayName":"Third","photoUrl":"https://picsum.photos/300"}],"validSince":"1698195790","email":"third@example.com","emailVerified":false,"disabled":false},{"localId":"92HncVCBiegd6rJP0Vt1gjVPz2cM","createdAt":"1650417583240","lastLoginAt":"1698195914227","displayName":"Tester","photoUrl":"https://picsum.photos/200","passwordHash":"fakeHash:salt=fakeSaltIiD2sStkbTThNgabfTRB:password=Qweqwe1!","salt":"fakeSaltIiD2sStkbTThNgabfTRB","passwordUpdatedAt":1698195790521,"providerUserInfo":[{"providerId":"password","email":"user@example.com","federatedId":"user@example.com","rawId":"user@example.com","displayName":"Tester","photoUrl":"https://picsum.photos/200"}],"validSince":"1698195790","email":"user@example.com","emailVerified":false,"disabled":false,"lastRefreshAt":"2023-10-25T01:05:14.228Z"},{"localId":"Sp0Vj5sxPqxhigfcEcMhLjBABKys","createdAt":"1650417747662","lastLoginAt":"1698195933819","displayName":"Admin","photoUrl":"https://picsum.photos/100","passwordHash":"fakeHash:salt=fakeSalteQRBxA7ZoPpuLT6a4FpJ:password=Qweqwe1!","salt":"fakeSalteQRBxA7ZoPpuLT6a4FpJ","passwordUpdatedAt":1698195790521,"providerUserInfo":[{"providerId":"password","email":"admin@example.com","federatedId":"admin@example.com","rawId":"admin@example.com","displayName":"Admin","photoUrl":"https://picsum.photos/100"}],"validSince":"1698195790","email":"admin@example.com","emailVerified":false,"disabled":false,"lastRefreshAt":"2023-10-25T01:05:33.819Z"},{"localId":"bqWC1RRnBBncEDJjb0qqq9q7lQUr","createdAt":"1695696328310","lastLoginAt":"1695696444840","displayName":"John Doe","photoUrl":"https://picsum.photos/id/22/100","passwordHash":"fakeHash:salt=fakeSaltCIpVFXmFNFHBXP9yUoXk:password=Qweqwe1!","salt":"fakeSaltCIpVFXmFNFHBXP9yUoXk","passwordUpdatedAt":1698195790521,"providerUserInfo":[{"providerId":"password","email":"j.doe@example.com","federatedId":"j.doe@example.com","rawId":"j.doe@example.com","displayName":"John Doe","photoUrl":"https://picsum.photos/id/22/100"}],"validSince":"1698195790","email":"j.doe@example.com","emailVerified":false,"disabled":false}]} |
Binary file modified
BIN
+0 Bytes
(100%)
...r_data/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata
Binary file not shown.
Binary file modified
BIN
+807 Bytes
(110%)
emulator_data/firestore_export/all_namespaces/all_kinds/output-0
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
emulator_data/firestore_export/firestore_export.overall_export_metadata
Binary file not shown.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"7IE7Zua6OBqK4YEGiF61TMo9agHL","createdAt":"1654454042657","lastLoginAt":"1679538347325","displayName":"John","photoUrl":"https://picsum.photos/id/338/100","passwordHash":"fakeHash:salt=fakeSaltyUiyIWr4ZqQrp1nzxltk:password=Qweqwe1!","salt":"fakeSaltyUiyIWr4ZqQrp1nzxltk","passwordUpdatedAt":1679519351308,"providerUserInfo":[{"providerId":"password","email":"john@example.com","federatedId":"john@example.com","rawId":"john@example.com","displayName":"John","photoUrl":"https://picsum.photos/id/338/100"}],"validSince":"1679519351","email":"john@example.com","emailVerified":false,"disabled":false,"lastRefreshAt":"2023-03-23T02:25:47.326Z","initialEmail":"third@example.com","customAttributes":""},{"localId":"92HncVCBiegd6rJP0Vt1gjVPz2cM","createdAt":"1650417583240","lastLoginAt":"1679532068271","displayName":"Isabel","photoUrl":"https://picsum.photos/id/342/100","passwordHash":"fakeHash:salt=fakeSaltdQhWGRJk5dYL7OLmJKKa:password=Qweqwe1!","salt":"fakeSaltdQhWGRJk5dYL7OLmJKKa","passwordUpdatedAt":1679519360121,"providerUserInfo":[{"providerId":"password","email":"isabel@example.com","federatedId":"isabel@example.com","rawId":"isabel@example.com","displayName":"Isabel","photoUrl":"https://picsum.photos/id/342/100"}],"validSince":"1679519360","email":"isabel@example.com","emailVerified":false,"disabled":false,"initialEmail":"user@example.com","customAttributes":"","lastRefreshAt":"2023-03-23T00:41:08.272Z"},{"localId":"Sp0Vj5sxPqxhigfcEcMhLjBABKys","createdAt":"1650417747662","lastLoginAt":"1679532639532","displayName":"Alice","photoUrl":"https://picsum.photos/id/237/100","passwordHash":"fakeHash:salt=fakeSaltbedHQHO9MWHasS5t2S4E:password=Qweqwe1!","salt":"fakeSaltbedHQHO9MWHasS5t2S4E","passwordUpdatedAt":1679519366497,"providerUserInfo":[{"providerId":"password","email":"alice@example.com","federatedId":"alice@example.com","rawId":"alice@example.com","displayName":"Alice","photoUrl":"https://picsum.photos/id/237/100"}],"validSince":"1679519366","email":"alice@example.com","emailVerified":false,"disabled":false,"initialEmail":"admin@example.com","customAttributes":"","lastRefreshAt":"2023-03-23T00:50:39.533Z"}]} | ||
{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"7IE7Zua6OBqK4YEGiF61TMo9agHL","createdAt":"1654454042657","lastLoginAt":"1679538347325","displayName":"John","photoUrl":"https://picsum.photos/id/338/100","passwordHash":"fakeHash:salt=fakeSaltyUiyIWr4ZqQrp1nzxltk:password=Qweqwe1!","salt":"fakeSaltyUiyIWr4ZqQrp1nzxltk","passwordUpdatedAt":1699408202871,"providerUserInfo":[{"providerId":"password","email":"john@example.com","federatedId":"john@example.com","rawId":"john@example.com","displayName":"John","photoUrl":"https://picsum.photos/id/338/100"}],"validSince":"1699408202","email":"john@example.com","emailVerified":false,"disabled":false},{"localId":"92HncVCBiegd6rJP0Vt1gjVPz2cM","createdAt":"1650417583240","lastLoginAt":"1679532068271","displayName":"Isabel","photoUrl":"https://picsum.photos/id/342/100","passwordHash":"fakeHash:salt=fakeSaltdQhWGRJk5dYL7OLmJKKa:password=Qweqwe1!","salt":"fakeSaltdQhWGRJk5dYL7OLmJKKa","passwordUpdatedAt":1699408202872,"providerUserInfo":[{"providerId":"password","email":"isabel@example.com","federatedId":"isabel@example.com","rawId":"isabel@example.com","displayName":"Isabel","photoUrl":"https://picsum.photos/id/342/100"}],"validSince":"1699408202","email":"isabel@example.com","emailVerified":false,"disabled":false},{"localId":"Sp0Vj5sxPqxhigfcEcMhLjBABKys","createdAt":"1650417747662","lastLoginAt":"1679532639532","displayName":"Alice","photoUrl":"https://picsum.photos/id/237/100","passwordHash":"fakeHash:salt=fakeSaltbedHQHO9MWHasS5t2S4E:password=Qweqwe1!","salt":"fakeSaltbedHQHO9MWHasS5t2S4E","passwordUpdatedAt":1699408202872,"providerUserInfo":[{"providerId":"password","email":"alice@example.com","federatedId":"alice@example.com","rawId":"alice@example.com","displayName":"Alice","photoUrl":"https://picsum.photos/id/237/100"}],"validSince":"1699408202","email":"alice@example.com","emailVerified":false,"disabled":false}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{ | ||
"version": "11.15.0", | ||
"version": "12.4.2", | ||
"firestore": { | ||
"version": "1.15.1", | ||
"version": "1.18.1", | ||
"path": "firestore_export", | ||
"metadata_file": "firestore_export/firestore_export.overall_export_metadata" | ||
}, | ||
"auth": { | ||
"version": "11.15.0", | ||
"version": "12.4.2", | ||
"path": "auth_export" | ||
}, | ||
"storage": { | ||
"version": "11.15.0", | ||
"version": "12.4.2", | ||
"path": "storage_export" | ||
} | ||
} |
Binary file modified
BIN
+0 Bytes
(100%)
...esting/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata
Binary file not shown.
Binary file modified
BIN
+22.4 KB
(260%)
emulator_data_testing/firestore_export/all_namespaces/all_kinds/output-0
Binary file not shown.
Binary file modified
BIN
+1 Byte
(100%)
emulator_data_testing/firestore_export/firestore_export.overall_export_metadata
Binary file not shown.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { firestore } from "firebase-admin"; | ||
import { DocumentSnapshot } from "firebase-admin/firestore"; | ||
import { Change } from "firebase-functions/v1"; | ||
import { calculateStage } from "../../utils/expenseUtils"; | ||
|
||
export async function updateUserExpenses(change: Change<DocumentSnapshot>) { | ||
const expenseData = change.after.data() ?? change.before.data() | ||
const expenseDeleted = !change.after.exists | ||
if (!expenseData) return | ||
|
||
const relatedUids = new Set([ | ||
...expenseData.assigneeIds, | ||
expenseData.authorUid | ||
]).values() | ||
|
||
for (const uid of relatedUids) { | ||
const userExpenseRef = firestore().collection('users').doc(uid).collection('expenses').doc(change.after.id) | ||
if (expenseDeleted) { | ||
await userExpenseRef.delete() | ||
} else { | ||
const stage = calculateStage(expenseData, uid) | ||
await userExpenseRef.set({ | ||
...expenseData, | ||
stage | ||
}) | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
functions/src/functions/notifications/notifyWhenExpenseFinalized.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
functions/src/functions/notifications/notifyWhenExpenseReverted.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function calculateStage(expense: any, assigneeId: string) { | ||
if (expense.finalizedDate != null) return 2 | ||
|
||
if (expense.unmarkedAssigneeIds.includes(assigneeId)) return 0 | ||
|
||
return 1 | ||
} |
Oops, something went wrong.