Allow 1 volunteer to submit report - #103
Conversation
00c7b57 to
75e6f14
Compare
There was a problem hiding this comment.
seeded data obtained after db_dump on our shared supabase remote, then applying the migrations from this PR
|
Hi @NicholasT1, can you rebase on master? |
675ef0a to
ddd8ba7
Compare
There was a problem hiding this comment.
Verified that migrations run successfully and data is seeded properly
|
|
||
| ### Prerequisites | ||
|
|
||
| - Docker Desktop (must be running) |
There was a problem hiding this comment.
Attempted to run local supabase and as another prerequisite required, google client id and secret are required as part of google auth provider. The supabase/config.toml file needs to be configured accordingly with those keys as well.
There was a problem hiding this comment.
I don't think it's super necessary for now since we can just login with email directly and the google login flow shouldn't need testing locally
| submittedAt: string | ||
| reporters: string[] | ||
| submittedCount: number | ||
| // submittedBy: string |
There was a problem hiding this comment.
Is this comment needed?
| : { data: [] } | ||
|
|
||
| const currentRoundSlotIds = (currentRoundSlots || []).map((slot) => slot.id) | ||
| const currentRoundUserSlotIds = currentRoundSlotIds.filter((id) => userSlotIds.includes(id)) |
There was a problem hiding this comment.
Instead of filtering here, maybe you can optimize this a little by adding a .in('slot_id', userSlotIds) clause in the db query for currentRoundSlots? db query is more optimized for this.
| return next | ||
| }) | ||
| } | ||
| const myObservation = observations |
There was a problem hiding this comment.
Is this re-assignment needed?
| roundName: string | ||
| } | ||
| observations: ObservationData[] | ||
| observations: ObservationData |
There was a problem hiding this comment.
| observations: ObservationData | |
| observation: ObservationData |
Perhaps renaming the prop into a singular form (or myObservation) may be more appropriate?
| .select('user_id, status, profiles:user_id(full_name, email)') | ||
| .eq('slot_id', data.slot_id) | ||
|
|
||
| const membership = (memberships || []).find((m) => m.status === 'ACTIVE') as { user_id: string; profiles: { full_name: string | null; email: string } | null } | undefined |
There was a problem hiding this comment.
Instead of one of the active members, I think this can display all active memberships instead since we are going under the assumption where all of them contributed to one single report (you may indicated who submitted the report when you handle #105 )
| }, | ||
| } as const | ||
|
|
||
| // Convenience type aliases used throughout the app. These are pure type |
There was a problem hiding this comment.
As far as I'm aware, there are several files that referenced imports for these types, so the deletion of these convenience type aliases will create compiler errors (use npx tsc --noEmit to check).
|
@NicholasT1 this PR is kinda huge, you might want to cherry pick the local supabase dev setup stuff (base migrations, seed, readme and config changes) into a separate branch so we can get that merged first! |
I think this PR is already quite big and for now, I might not have much time to work on this. Not ideal to leave comments but I feel if another team member has the bandwidth to work on #105, it would be preferable to waiting for me to eventually finish it. |
ddd8ba7 to
b20608f
Compare
Changes
Note
After this PR
Closes #104