mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-27 15:17:30 +00:00
style(server): format the files the health lanes added or moved
Prettier on every new or moved file that was not formatted, so lint:format holds them; the files taken off the format baseline are the ones that moved or were formatted on the way.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
import type { JsonColumn } from '../utils/json-column';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* The JSON-in-TEXT columns the services decode, one declaration each: the shape
|
||||
* the column holds and what a reader gets when a row is empty or broken. Read
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { EntityManager } from '@mikro-orm/core';
|
||||
import type { SqlEntityManager } from '@mikro-orm/sql';
|
||||
import { Users } from '../entities/Users.entity';
|
||||
import { TrekRepository } from './_shared/trek-repository';
|
||||
import type { EntityManager } from '@mikro-orm/core';
|
||||
import type { SqlEntityManager } from '@mikro-orm/sql';
|
||||
|
||||
/**
|
||||
* The AirTrail connection a user keeps on their own `users` row
|
||||
@@ -57,10 +57,21 @@ export class UserAirtrailRepository extends TrekRepository<Users> {
|
||||
* wrap its writes in `uow.transactional`): preserved exactly, not
|
||||
* "fixed" to match Dawarich's shape.
|
||||
*/
|
||||
async setAirtrailSettingsWithKey(id: number, url: string | null, apiKey: string, allowInsecureTls: number, writeEnabled: number): Promise<void> {
|
||||
async setAirtrailSettingsWithKey(
|
||||
id: number,
|
||||
url: string | null,
|
||||
apiKey: string,
|
||||
allowInsecureTls: number,
|
||||
writeEnabled: number,
|
||||
): Promise<void> {
|
||||
await this.nativeUpdate(
|
||||
{ id },
|
||||
{ airtrail_url: url, airtrail_api_key: apiKey, airtrail_allow_insecure_tls: allowInsecureTls, airtrail_write_enabled: writeEnabled },
|
||||
{
|
||||
airtrail_url: url,
|
||||
airtrail_api_key: apiKey,
|
||||
airtrail_allow_insecure_tls: allowInsecureTls,
|
||||
airtrail_write_enabled: writeEnabled,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,8 +81,16 @@ export class UserAirtrailRepository extends TrekRepository<Users> {
|
||||
* airtrail_write_enabled = ? WHERE id = ?`. Same no-transaction asymmetry
|
||||
* as {@link setAirtrailSettingsWithKey} — preserved, not fixed.
|
||||
*/
|
||||
async setAirtrailSettings(id: number, url: string | null, allowInsecureTls: number, writeEnabled: number): Promise<void> {
|
||||
await this.nativeUpdate({ id }, { airtrail_url: url, airtrail_allow_insecure_tls: allowInsecureTls, airtrail_write_enabled: writeEnabled });
|
||||
async setAirtrailSettings(
|
||||
id: number,
|
||||
url: string | null,
|
||||
allowInsecureTls: number,
|
||||
writeEnabled: number,
|
||||
): Promise<void> {
|
||||
await this.nativeUpdate(
|
||||
{ id },
|
||||
{ airtrail_url: url, airtrail_allow_insecure_tls: allowInsecureTls, airtrail_write_enabled: writeEnabled },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { EntityManager } from '@mikro-orm/core';
|
||||
import type { SqlEntityManager } from '@mikro-orm/sql';
|
||||
import { coalesceOverrideWhileSame } from '../dialect/sql-functions';
|
||||
import { Users } from '../entities/Users.entity';
|
||||
import { TrekRepository } from './_shared/trek-repository';
|
||||
import { coalesceOverrideWhileSame } from '../dialect/sql-functions';
|
||||
import type { EntityManager } from '@mikro-orm/core';
|
||||
import type { SqlEntityManager } from '@mikro-orm/sql';
|
||||
|
||||
/**
|
||||
* The Immich connection a user keeps on their own `users` row (`immich_url`,
|
||||
@@ -26,9 +26,11 @@ export class UserImmichRepository extends TrekRepository<Users> {
|
||||
* immich_api_key, immich_allow_insecure_tls FROM users WHERE id = ?`
|
||||
* (the TLS switch joined the read with #2475).
|
||||
*/
|
||||
async getImmichCredentials(
|
||||
id: number,
|
||||
): Promise<{ immich_url: string | null; immich_api_key: string | null; immich_allow_insecure_tls: number | null } | null> {
|
||||
async getImmichCredentials(id: number): Promise<{
|
||||
immich_url: string | null;
|
||||
immich_api_key: string | null;
|
||||
immich_allow_insecure_tls: number | null;
|
||||
} | null> {
|
||||
const row = await this.findOne({ id }, { fields: ['immich_url', 'immich_api_key', 'immich_allow_insecure_tls'] });
|
||||
return row
|
||||
? {
|
||||
@@ -55,7 +57,10 @@ export class UserImmichRepository extends TrekRepository<Users> {
|
||||
): Promise<{ immich_auto_upload: number | null; immich_allow_insecure_tls: number | null } | null> {
|
||||
const row = await this.findOne({ id }, { fields: ['immich_auto_upload', 'immich_allow_insecure_tls'] });
|
||||
return row
|
||||
? { immich_auto_upload: row.immich_auto_upload ?? null, immich_allow_insecure_tls: row.immich_allow_insecure_tls ?? null }
|
||||
? {
|
||||
immich_auto_upload: row.immich_auto_upload ?? null,
|
||||
immich_allow_insecure_tls: row.immich_allow_insecure_tls ?? null,
|
||||
}
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -88,7 +93,13 @@ export class UserImmichRepository extends TrekRepository<Users> {
|
||||
{
|
||||
immich_url,
|
||||
immich_api_key,
|
||||
immich_allow_insecure_tls: coalesceOverrideWhileSame(platform, allow_insecure_tls, 'immich_allow_insecure_tls', 'immich_url', immich_url),
|
||||
immich_allow_insecure_tls: coalesceOverrideWhileSame(
|
||||
platform,
|
||||
allow_insecure_tls,
|
||||
'immich_allow_insecure_tls',
|
||||
'immich_url',
|
||||
immich_url,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import type { EntityManager } from '@mikro-orm/core';
|
||||
import type { SqlEntityManager } from '@mikro-orm/sql';
|
||||
import { Users } from '../entities/Users.entity';
|
||||
import { TrekRepository } from './_shared/trek-repository';
|
||||
import type { EntityManager } from '@mikro-orm/core';
|
||||
import type { SqlEntityManager } from '@mikro-orm/sql';
|
||||
|
||||
/**
|
||||
* The six Synology credential/session columns `_readSynologyUser` reads
|
||||
* selectively — a closed union, not a dynamic column string, matching
|
||||
* `InstanceApiKeyName`'s reasoning in `Users.repository.ts`.
|
||||
*/
|
||||
export type SynologyUserColumn = 'synology_url' | 'synology_username' | 'synology_password' | 'synology_sid' | 'synology_did' | 'synology_skip_ssl';
|
||||
export type SynologyUserColumn =
|
||||
'synology_url' | 'synology_username' | 'synology_password' | 'synology_sid' | 'synology_did' | 'synology_skip_ssl';
|
||||
|
||||
/**
|
||||
* {@link UserSynologyRepository.getSynologyFields}'s return shape — structurally
|
||||
@@ -94,7 +95,13 @@ export class UserSynologyRepository extends TrekRepository<Users> {
|
||||
}
|
||||
|
||||
/** SY5 (`SynologyService.updateSynologySettings`) — `UPDATE users SET synology_url = ?, synology_username = ?, synology_password = ?, synology_skip_ssl = ? WHERE id = ?`. */
|
||||
async setSynologySettings(id: number, synology_url: string, synology_username: string, synology_password: string | null, synology_skip_ssl: number): Promise<void> {
|
||||
async setSynologySettings(
|
||||
id: number,
|
||||
synology_url: string,
|
||||
synology_username: string,
|
||||
synology_password: string | null,
|
||||
synology_skip_ssl: number,
|
||||
): Promise<void> {
|
||||
await this.nativeUpdate({ id }, { synology_url, synology_username, synology_password, synology_skip_ssl });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user