Cleaning up comments

This commit is contained in:
2026-03-06 05:21:41 +01:00
parent fe2347b54e
commit 10467dfccb
50 changed files with 51 additions and 885 deletions

View File

@@ -1,9 +1,3 @@
/**
* Thin service layer - binds every CQRS handler to `getDataSource()` so
* routes can call one-liner functions instead of manually constructing
* command/query objects and passing the DataSource every time.
*/
import { getDataSource } from '../db';
import {
CommandType,
@@ -25,8 +19,6 @@ import { handleGetServerById } from './queries/handlers/getServerById';
import { handleGetJoinRequestById } from './queries/handlers/getJoinRequestById';
import { handleGetPendingRequestsForServer } from './queries/handlers/getPendingRequestsForServer';
// --------------- Commands ---------------
export const registerUser = (user: AuthUserPayload) =>
handleRegisterUser({ type: CommandType.RegisterUser, payload: { user } }, getDataSource());
@@ -45,8 +37,6 @@ export const updateJoinRequestStatus = (requestId: string, status: JoinRequestPa
export const deleteStaleJoinRequests = (maxAgeMs: number) =>
handleDeleteStaleJoinRequests({ type: CommandType.DeleteStaleJoinRequests, payload: { maxAgeMs } }, getDataSource());
// --------------- Queries ---------------
export const getUserByUsername = (username: string) =>
handleGetUserByUsername({ type: QueryType.GetUserByUsername, payload: { username } }, getDataSource());

View File

@@ -1,10 +1,3 @@
/* ------------------------------------------------------------------ */
/* CQRS type definitions for the MetoYou server process. */
/* Commands mutate state; queries read state. */
/* ------------------------------------------------------------------ */
// --------------- Command types ---------------
export const CommandType = {
RegisterUser: 'register-user',
UpsertServer: 'upsert-server',
@@ -16,8 +9,6 @@ export const CommandType = {
export type CommandTypeKey = typeof CommandType[keyof typeof CommandType];
// --------------- Query types ---------------
export const QueryType = {
GetUserByUsername: 'get-user-by-username',
GetUserById: 'get-user-by-id',
@@ -29,8 +20,6 @@ export const QueryType = {
export type QueryTypeKey = typeof QueryType[keyof typeof QueryType];
// --------------- Payload interfaces ---------------
export interface AuthUserPayload {
id: string;
username: string;
@@ -63,8 +52,6 @@ export interface JoinRequestPayload {
createdAt: number;
}
// --------------- Command interfaces ---------------
export interface RegisterUserCommand {
type: typeof CommandType.RegisterUser;
payload: { user: AuthUserPayload };
@@ -103,8 +90,6 @@ export type Command =
| UpdateJoinRequestStatusCommand
| DeleteStaleJoinRequestsCommand;
// --------------- Query interfaces ---------------
export interface GetUserByUsernameQuery {
type: typeof QueryType.GetUserByUsername;
payload: { username: string };