feat: implement friendship system with requests and management features
All checks were successful
Build Docker Image / build (push) Successful in 1m15s

- Added a new friendship table schema to manage friend requests and relationships.
- Updated profile page to include tabs for managing friends, incoming requests, and outgoing requests.
- Implemented functionality to send, accept, decline, cancel, and remove friend requests.
- Enhanced user experience with feedback messages for friend request actions.
This commit is contained in:
2026-03-06 19:28:42 +01:00
parent 5cd989b098
commit f35f4565b6
6 changed files with 1714 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ import { user } from './auth.schema';
export type DevilFruitType = 'Paramecia' | 'Zoan' | 'Logia' | 'Smile' | 'Unknown';
export type Status = 'Alive' | 'Dead' | 'Unknown';
export type FriendshipStatus = 'pending' | 'accepted' | 'declined';
// Define the site config table schema
export const config = sqliteTable('config', {
@@ -122,5 +123,23 @@ export const userCharacterHistory = sqliteTable('userCharacterHistory', {
unique().on(table.userId, table.characterHistoryId)
]);
// Define the friendship table schema (friend requests + accepted friends)
export const friendship = sqliteTable('friendship', {
id: text('id')
.primaryKey()
.$defaultFn(() => crypto.randomUUID()),
requesterId: text('requesterId')
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),
addresseeId: text('addresseeId')
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),
status: text('status').$type<FriendshipStatus>().notNull().default('pending'),
createdAt: integer('createdAt').notNull().$default(() => Date.now()),
updatedAt: integer('updatedAt').notNull().$default(() => Date.now()),
}, (table) => [
unique().on(table.requesterId, table.addresseeId)
]);
export * from './auth.schema';