mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 14:06:27 +00:00
724c88c201
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { CollabMessages } from '../../../src/db/entities/CollabMessages.entity';
|
|
import { CollabNotes } from '../../../src/db/entities/CollabNotes.entity';
|
|
import type { FactoryOrm } from './context';
|
|
import { createRow } from './rows';
|
|
import type { EntityData, EntityDTO } from '@mikro-orm/core';
|
|
|
|
export type CollabNoteRow = EntityDTO<CollabNotes>;
|
|
export type CollabMessageRow = EntityDTO<CollabMessages>;
|
|
|
|
/** A note on the trip's collab board, written by `userId`. */
|
|
export function makeCollabNote(
|
|
orm: FactoryOrm,
|
|
tripId: number,
|
|
userId: number,
|
|
overrides: EntityData<CollabNotes> = {},
|
|
): Promise<CollabNoteRow> {
|
|
return createRow(orm, CollabNotes, {
|
|
trip: tripId,
|
|
user: userId,
|
|
title: 'Test Note',
|
|
content: null,
|
|
category: 'General',
|
|
color: '#6366f1',
|
|
...overrides,
|
|
});
|
|
}
|
|
|
|
/** A chat message on the trip; `replyToRef` makes it a reply. */
|
|
export function makeCollabMessage(
|
|
orm: FactoryOrm,
|
|
tripId: number,
|
|
userId: number,
|
|
overrides: EntityData<CollabMessages> = {},
|
|
): Promise<CollabMessageRow> {
|
|
return createRow(orm, CollabMessages, { trip: tripId, user: userId, text: 'Test message', ...overrides });
|
|
}
|