mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-12-01 22:28:00 -07:00
Meta を二重にデータベースに保存できないように
This commit is contained in:
parent
0b4d7de915
commit
660a976a1c
2 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,5 @@
|
||||||
import { Meta } from '../models/entities/meta';
|
import { Meta } from '../models/entities/meta';
|
||||||
import { Metas } from '../models';
|
import { Metas } from '../models';
|
||||||
import { genId } from './gen-id';
|
|
||||||
|
|
||||||
export default async function(): Promise<Meta> {
|
export default async function(): Promise<Meta> {
|
||||||
const meta = await Metas.findOne();
|
const meta = await Metas.findOne();
|
||||||
|
@ -8,7 +7,7 @@ export default async function(): Promise<Meta> {
|
||||||
return meta;
|
return meta;
|
||||||
} else {
|
} else {
|
||||||
return Metas.save({
|
return Metas.save({
|
||||||
id: genId(),
|
id: 'x'
|
||||||
} as Meta);
|
} as Meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { Entity, Column, PrimaryColumn } from 'typeorm';
|
import { Entity, Column, PrimaryColumn } from 'typeorm';
|
||||||
import { id } from '../id';
|
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Meta {
|
export class Meta {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn({
|
||||||
|
type: 'varchar',
|
||||||
|
length: 32
|
||||||
|
})
|
||||||
public id: string;
|
public id: string;
|
||||||
|
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
|
|
Loading…
Reference in a new issue