mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 09:45:37 -04:00

One of the aliases can be primary for each note, but all can be used to get information from the apis. Signed-off-by: Philip Molares <philip.molares@udo.edu>
22 lines
461 B
TypeScript
22 lines
461 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
import { ValueTransformer } from 'typeorm';
|
|
|
|
export class PrimaryValueTransformer implements ValueTransformer {
|
|
from(value: boolean | null): boolean {
|
|
if (value === null) {
|
|
return false;
|
|
}
|
|
return value;
|
|
}
|
|
|
|
to(value: boolean): boolean | null {
|
|
if (!value) {
|
|
return null;
|
|
}
|
|
return value;
|
|
}
|
|
}
|