Cleaning up comments
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user