project-standalo-sonic-cloud/types/types.ts

142 lines
3.7 KiB
TypeScript

// Auto-generated from design document
// Generated: 2025-12-18T15:56:41
// =============================================================================
// DATA MODEL TYPES
// =============================================================================
/**
* Base user entity with authentication
* Table: users
*/
export interface User {
id: string; // primary_key
email: string; // unique, not_null
password_hash: string; // not_null
name: string; // not_null
role: 'musician' | 'listener' | 'label'; // not_null
email_verified: boolean;
avatar_url?: string; // nullable
created_at: Date | string; // not_null
updated_at: Date | string; // not_null
}
/**
* Extended profile for musicians
* Table: artists
*/
export interface Artist {
id: string; // primary_key
user_id: string; // not_null, foreign_key
stage_name: string; // not_null
bio?: string; // nullable
cover_image_url?: string; // nullable
social_links?: Record<string, string>; // nullable
verified: boolean;
created_at: Date | string; // not_null
updated_at: Date | string; // not_null
}
/**
* Organization profile for labels
* Table: labels
*/
export interface Label {
id: string; // primary_key
user_id: string; // not_null, foreign_key
label_name: string; // not_null
description?: string; // nullable
logo_url?: string; // nullable
website?: string; // nullable
created_at: Date | string; // not_null
updated_at: Date | string; // not_null
}
/**
* Music category for discovery
* Table: genres
*/
export interface Genre {
id: string; // primary_key
name: string; // unique, not_null
slug: string; // unique, not_null
description?: string; // nullable
created_at: Date | string; // not_null
updated_at: Date | string; // not_null
}
/**
* Collection of songs
* Table: albums
*/
export interface Album {
id: string; // primary_key
artist_id: string; // not_null, foreign_key
title: string; // not_null
description?: string; // nullable
cover_art_url?: string; // nullable
release_date?: string; // nullable
album_type: 'album' | 'ep' | 'single';
created_at: Date | string; // not_null
updated_at: Date | string; // not_null
}
/**
* Audio track with metadata
* Table: songs
*/
export interface Song {
id: string; // primary_key
artist_id: string; // not_null, foreign_key
album_id?: string; // nullable, foreign_key
title: string; // not_null
duration: number; // not_null
file_url: string; // not_null
file_format: 'mp3' | 'wav'; // not_null
file_size: number; // not_null
waveform_data?: number[]; // nullable
cover_art_url?: string; // nullable
release_date?: string; // nullable
play_count: number;
is_public: boolean;
track_number?: number; // nullable
created_at: Date | string; // not_null
updated_at: Date | string; // not_null
}
/**
* Junction table for song-genre many-to-many
* Table: song_genres
*/
export interface SongGenre {
song_id: string; // not_null, foreign_key
genre_id: string; // not_null, foreign_key
}
/**
* User-created song collection
* Table: playlists
*/
export interface Playlist {
id: string; // primary_key
user_id: string; // not_null, foreign_key
name: string; // not_null
description?: string; // nullable
cover_image_url?: string; // nullable
is_public: boolean;
created_at: Date | string; // not_null
updated_at: Date | string; // not_null
}
/**
* Junction table with ordering for playlists
* Table: playlist_songs
*/
export interface PlaylistSong {
id: string; // primary_key
playlist_id: string; // not_null, foreign_key
song_id: string; // not_null, foreign_key
position: number; // not_null
added_at: Date | string; // not_null
}