vibe coded v1

This commit is contained in:
khannurien
2026-03-16 07:34:49 +00:00
parent 6207a7549f
commit e88fed4e98
48 changed files with 4303 additions and 595 deletions

View File

@@ -2,12 +2,29 @@
* Backend
*/
export interface RichContent {
type: string;
url: string;
siteName?: string;
title?: string;
description?: string;
thumbnailUrl?: string;
videoId?: string;
}
export interface Dump {
id: string;
kind: "url" | "file";
title: string;
description?: string;
comment?: string;
userId: string;
createdAt: Date;
url?: string;
richContent?: RichContent;
fileName?: string;
fileMime?: string;
fileSize?: number;
voteCount: number;
}
/**
@@ -19,6 +36,16 @@ export interface User {
username: string;
isAdmin: boolean;
createdAt: Date;
avatarMime?: string;
}
// Public user profile (no passwordHash)
export interface PublicUser {
id: string;
username: string;
isAdmin: boolean;
createdAt: Date;
avatarMime?: string;
}
export interface LoginUserRequest {
@@ -46,14 +73,15 @@ export interface AuthResponse {
* API
*/
export enum APIErrorCode {
BAD_REQUEST = "BAD_REQUEST",
NOT_FOUND = "NOT_FOUND",
SERVER_ERROR = "SERVER_ERROR",
TIMEOUT = "TIMEOUT",
UNAUTHORIZED = "UNAUTHORIZED",
VALIDATION_ERROR = "VALIDATION_ERROR",
}
export const APIErrorCode = {
BAD_REQUEST: "BAD_REQUEST",
NOT_FOUND: "NOT_FOUND",
SERVER_ERROR: "SERVER_ERROR",
TIMEOUT: "TIMEOUT",
UNAUTHORIZED: "UNAUTHORIZED",
VALIDATION_ERROR: "VALIDATION_ERROR",
} as const;
export type APIErrorCode = typeof APIErrorCode[keyof typeof APIErrorCode];
export interface APIError {
code: APIErrorCode;
@@ -78,30 +106,78 @@ export type APIResponse<T> = APISuccess<T> | APIFailure;
* Request DTOs
*/
export interface CreateDumpRequest {
title: string;
description?: string;
export interface CreateUrlDumpRequest {
url: string;
comment?: string;
}
export interface UpdateDumpRequest {
title?: string;
description?: string;
url?: string;
comment?: string;
}
export interface LoginUserRequest {
/**
* WebSockets
*/
export interface VoteCastMessage {
type: "vote_cast";
dumpId: string;
userId: string;
}
export interface VoteAckMessageFailure {
type: "vote_ack";
dumpId: string;
success: false;
error: APIError;
}
export interface VoteAckMessageSuccess {
type: "vote_ack";
dumpId: string;
action: "cast" | "remove";
success: true;
voteCount: number;
error?: never;
}
export type VoteAckMessage = VoteAckMessageSuccess | VoteAckMessageFailure;
export interface VoteRemoveMessage {
type: "vote_remove";
dumpId: string;
}
export interface VotesUpdateMessage {
type: "votes_update";
dumpId: string;
voteCount: number;
}
export interface OnlineUser {
userId: string;
username: string;
password: string;
hasAvatar: boolean;
}
export interface RegisterUserRequest {
username: string;
password: string;
export interface WelcomeMessage {
type: "welcome";
users: OnlineUser[];
myVotes: string[];
}
export interface UpdateUserRequest {
username?: string;
password?: string;
isAdmin?: boolean;
export interface PresenceUpdateMessage {
type: "presence_update";
users: OnlineUser[];
}
export interface PingMessage {
type: "ping";
}
export interface PongMessage {
type: "pong";
}
/**