hippofish/src/misc/fetch-meta.ts
syuilo 987168b863
strictNullChecks (#4666)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip
2019-04-13 01:43:22 +09:00

14 lines
299 B
TypeScript

import { Meta } from '../models/entities/meta';
import { Metas } from '../models';
import { genId } from './gen-id';
export default async function(): Promise<Meta> {
const meta = await Metas.findOne();
if (meta) {
return meta;
} else {
return Metas.save({
id: genId(),
} as Meta);
}
}