setup firebase custom token

This commit is contained in:
talksik
2026-04-16 11:26:11 -07:00
parent 28b1ff542b
commit 41fe404d0a
20 changed files with 494 additions and 31 deletions
+22
View File
@@ -47,6 +47,7 @@ type repository interface {
getNetworksForHuman(ctx context.Context, humanId string) ([]*Network, error)
isMember(ctx context.Context, networkID, humanId string) (bool, error)
listAll(ctx context.Context) ([]*Network, error)
listAllMemberships(ctx context.Context) (map[string][]string, error)
// Invitations
createInvitation(ctx context.Context, networkID, email string) error
@@ -232,6 +233,27 @@ func (r *repositoryImpl) isMember(ctx context.Context, networkID, humanId string
return isMember, err
}
// listAllMemberships returns humanId -> networkIds for every human with at
// least one membership. Humans with zero memberships are absent from the map;
// callers layer them in separately.
func (r *repositoryImpl) listAllMemberships(ctx context.Context) (map[string][]string, error) {
rows, err := r.pool.Query(ctx, `SELECT human_id, network_id FROM network_members`)
if err != nil {
return nil, err
}
defer rows.Close()
out := map[string][]string{}
for rows.Next() {
var humanId, networkId string
if err := rows.Scan(&humanId, &networkId); err != nil {
return nil, err
}
out[humanId] = append(out[humanId], networkId)
}
return out, rows.Err()
}
func (r *repositoryImpl) listAll(ctx context.Context) ([]*Network, error) {
rows, err := r.pool.Query(ctx,
`SELECT `+networkColumns+` FROM networks`,