mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-15 06:58:53 +09:00
18 lines
574 B
TypeScript
18 lines
574 B
TypeScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import {createUserID, type UserID} from '@app/api/BrandedTypes';
|
|
import {DELETED_USER_ID} from '@fluxer/constants/src/UserConstants';
|
|
import {UnknownUserError} from '@fluxer/errors/src/domains/user/UnknownUserError';
|
|
|
|
export const SYSTEM_USER_ID = createUserID(0n);
|
|
|
|
export function isSyntheticUserId(userId: UserID): boolean {
|
|
return userId === SYSTEM_USER_ID || userId === DELETED_USER_ID;
|
|
}
|
|
|
|
export function assertMutableUserId(userId: UserID): void {
|
|
if (isSyntheticUserId(userId)) {
|
|
throw new UnknownUserError();
|
|
}
|
|
}
|