feat(fase-1): auth, collective management, and DB migrations
- SQL migrations: users, collectives, collective_members, collective_invitations,
full RLS policies, is_active_member/is_member/is_admin helpers,
accept_invitation SECURITY DEFINER function, admin auto-promote trigger,
avatars storage bucket
- Auth refactor: replace keycloak-js with Supabase OAuth (GoTrue OIDC proxy,
Option B). signInWithOAuth({ provider: 'keycloak' }) + PKCE flow
- GoTrue config: GOTRUE_EXTERNAL_KEYCLOAK_URL + GOTRUE_EXTERNAL_KEYCLOAK_REDIRECT_URI
added to docker-compose.dev.yml; Keycloak realm updated with GoTrue callback URI
- New routes: /auth/callback, /invitation/[token], /(app)/collective/manage
- Functional onboarding: create collective or join via invite link
- Full settings page: display name (debounced), avatar (initials/emoji/upload),
language switcher, Keycloak account console link
- Components: Avatar.svelte (initials/emoji/upload with fallback),
ImageCropper.svelte (cropperjs, 1:1 crop, lazy-loaded)
- i18n: added all Fase 1 message keys (en + es); renamed 'delete' → 'action_delete'
(JS reserved word); fixed plugin-m-function-matcher major-version URL format
- Database types: manually seeded packages/types/src/database.ts from migrations
- .env.development: committed public dev defaults for SvelteKit type checking
- CLAUDE.md: documented /etc/hosts requirement for keycloak hostname
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,190 @@
|
||||
// AUTO-GENERATED — do not edit manually.
|
||||
// Run `just db-types` to regenerate from Supabase schema.
|
||||
// Placeholder until migrations exist and `supabase gen types typescript` can run.
|
||||
// Manually seeded from migrations until `supabase gen types typescript` can run.
|
||||
|
||||
export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[];
|
||||
|
||||
export type LanguageCode = 'en' | 'es';
|
||||
export type AvatarTypeEnum = 'initials' | 'emoji' | 'upload';
|
||||
export type MemberRoleEnum = 'admin' | 'member' | 'guest';
|
||||
|
||||
export interface Database {
|
||||
public: {
|
||||
Tables: Record<string, never>;
|
||||
Tables: {
|
||||
users: {
|
||||
Row: {
|
||||
id: string;
|
||||
email: string;
|
||||
display_name: string;
|
||||
language: LanguageCode;
|
||||
avatar_type: AvatarTypeEnum;
|
||||
avatar_emoji: string | null;
|
||||
avatar_url: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
};
|
||||
Insert: {
|
||||
id: string;
|
||||
email: string;
|
||||
display_name?: string;
|
||||
language?: LanguageCode;
|
||||
avatar_type?: AvatarTypeEnum;
|
||||
avatar_emoji?: string | null;
|
||||
avatar_url?: string | null;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
};
|
||||
Update: {
|
||||
id?: string;
|
||||
email?: string;
|
||||
display_name?: string;
|
||||
language?: LanguageCode;
|
||||
avatar_type?: AvatarTypeEnum;
|
||||
avatar_emoji?: string | null;
|
||||
avatar_url?: string | null;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
};
|
||||
Relationships: [];
|
||||
};
|
||||
collectives: {
|
||||
Row: {
|
||||
id: string;
|
||||
name: string;
|
||||
emoji: string;
|
||||
created_by: string;
|
||||
created_at: string;
|
||||
};
|
||||
Insert: {
|
||||
id?: string;
|
||||
name: string;
|
||||
emoji?: string;
|
||||
created_by: string;
|
||||
created_at?: string;
|
||||
};
|
||||
Update: {
|
||||
id?: string;
|
||||
name?: string;
|
||||
emoji?: string;
|
||||
created_by?: string;
|
||||
created_at?: string;
|
||||
};
|
||||
Relationships: [
|
||||
{
|
||||
foreignKeyName: 'collectives_created_by_fkey';
|
||||
columns: ['created_by'];
|
||||
referencedRelation: 'users';
|
||||
referencedColumns: ['id'];
|
||||
}
|
||||
];
|
||||
};
|
||||
collective_members: {
|
||||
Row: {
|
||||
collective_id: string;
|
||||
user_id: string;
|
||||
role: MemberRoleEnum;
|
||||
joined_at: string;
|
||||
};
|
||||
Insert: {
|
||||
collective_id: string;
|
||||
user_id: string;
|
||||
role?: MemberRoleEnum;
|
||||
joined_at?: string;
|
||||
};
|
||||
Update: {
|
||||
collective_id?: string;
|
||||
user_id?: string;
|
||||
role?: MemberRoleEnum;
|
||||
joined_at?: string;
|
||||
};
|
||||
Relationships: [
|
||||
{
|
||||
foreignKeyName: 'collective_members_collective_id_fkey';
|
||||
columns: ['collective_id'];
|
||||
referencedRelation: 'collectives';
|
||||
referencedColumns: ['id'];
|
||||
},
|
||||
{
|
||||
foreignKeyName: 'collective_members_user_id_fkey';
|
||||
columns: ['user_id'];
|
||||
referencedRelation: 'users';
|
||||
referencedColumns: ['id'];
|
||||
}
|
||||
];
|
||||
};
|
||||
collective_invitations: {
|
||||
Row: {
|
||||
id: string;
|
||||
collective_id: string;
|
||||
token: string;
|
||||
role: MemberRoleEnum;
|
||||
created_by: string;
|
||||
created_at: string;
|
||||
expires_at: string;
|
||||
accepted_at: string | null;
|
||||
accepted_by: string | null;
|
||||
};
|
||||
Insert: {
|
||||
id?: string;
|
||||
collective_id: string;
|
||||
token?: string;
|
||||
role?: MemberRoleEnum;
|
||||
created_by: string;
|
||||
created_at?: string;
|
||||
expires_at?: string;
|
||||
accepted_at?: string | null;
|
||||
accepted_by?: string | null;
|
||||
};
|
||||
Update: {
|
||||
id?: string;
|
||||
collective_id?: string;
|
||||
token?: string;
|
||||
role?: MemberRoleEnum;
|
||||
created_by?: string;
|
||||
created_at?: string;
|
||||
expires_at?: string;
|
||||
accepted_at?: string | null;
|
||||
accepted_by?: string | null;
|
||||
};
|
||||
Relationships: [
|
||||
{
|
||||
foreignKeyName: 'collective_invitations_collective_id_fkey';
|
||||
columns: ['collective_id'];
|
||||
referencedRelation: 'collectives';
|
||||
referencedColumns: ['id'];
|
||||
},
|
||||
{
|
||||
foreignKeyName: 'collective_invitations_created_by_fkey';
|
||||
columns: ['created_by'];
|
||||
referencedRelation: 'users';
|
||||
referencedColumns: ['id'];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
Views: Record<string, never>;
|
||||
Functions: Record<string, never>;
|
||||
Enums: Record<string, never>;
|
||||
Functions: {
|
||||
accept_invitation: {
|
||||
Args: { p_token: string };
|
||||
Returns: Json;
|
||||
};
|
||||
is_active_member: {
|
||||
Args: { p_collective_id: string };
|
||||
Returns: boolean;
|
||||
};
|
||||
is_member: {
|
||||
Args: { p_collective_id: string };
|
||||
Returns: boolean;
|
||||
};
|
||||
is_admin: {
|
||||
Args: { p_collective_id: string };
|
||||
Returns: boolean;
|
||||
};
|
||||
};
|
||||
Enums: {
|
||||
language_code: LanguageCode;
|
||||
avatar_type: AvatarTypeEnum;
|
||||
member_role: MemberRoleEnum;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user