mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
f0a3fe9dbb
- Tests that still knew the ChatGPT sign-in as personal only follow the admin's shared plan: the service takes the caller with their role, the admin tiles show ChatGPT, the controller tests cover the admin routes. - The table refused an instance ChatGPT connection with a CHECK, so sharing the plan failed. A new migration rebuilds ai_connections without that check; the shipped migration stays as it was. - useChatgptConnect grew past the function size limit: reading the clipboard and noticing the return to the tab are helpers of their own. - The file link factory hands its overrides over apart from the row, like every other factory, which ends the deep type instantiation. - Knip: exports only their own file used are private again, and the booking cap reads MAX_WRITES_PER_STEP instead of an alias. - lint:i18n-keys reaches the tools' own action names through a key builder and the connection hints through literal keys. - MMehrSheet stays in the assistant hints pair only.
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { FileLinks } from '../../../src/db/entities/FileLinks.entity';
|
|
import { TripFiles } from '../../../src/db/entities/TripFiles.entity';
|
|
import { nextSeq, type FactoryOrm } from './context';
|
|
import { createRow } from './rows';
|
|
import type { EntityData, EntityDTO } from '@mikro-orm/core';
|
|
|
|
export type TripFileRow = EntityDTO<TripFiles>;
|
|
export type FileLinkRow = EntityDTO<FileLinks>;
|
|
|
|
/**
|
|
* A file row on the trip. Only the row: a test that downloads the file also
|
|
* writes the bytes through the storage fixture (`storage-fixture.ts`).
|
|
*/
|
|
export function makeTripFile(
|
|
orm: FactoryOrm,
|
|
tripId: number,
|
|
overrides: EntityData<TripFiles> = {},
|
|
): Promise<TripFileRow> {
|
|
const n = nextSeq('trip-file');
|
|
return createRow(
|
|
orm,
|
|
TripFiles,
|
|
{
|
|
trip: tripId,
|
|
filename: `test-file-${n}.pdf`,
|
|
original_name: `Test File ${n}.pdf`,
|
|
file_size: 1024,
|
|
mime_type: 'application/pdf',
|
|
},
|
|
overrides,
|
|
);
|
|
}
|
|
|
|
/** Links the file to a booking, an assignment, a place or an expense (name exactly one in `target`). */
|
|
export function linkFile(
|
|
orm: FactoryOrm,
|
|
fileId: number,
|
|
target: Pick<EntityData<FileLinks>, 'reservation' | 'assignment' | 'place' | 'budgetItem'>,
|
|
): Promise<FileLinkRow> {
|
|
return createRow(orm, FileLinks, { file: fileId }, target);
|
|
}
|