Enforce URI uniquness
This commit is contained in:
parent
18f317a4ac
commit
fdc81f395d
6 changed files with 82 additions and 48 deletions
|
|
@ -11,6 +11,8 @@ import { pack as packFile } from './drive-file';
|
|||
|
||||
const Post = db.get<IPost>('posts');
|
||||
|
||||
Post.createIndex('uri', { sparse: true, unique: true });
|
||||
|
||||
export default Post;
|
||||
|
||||
export function isValidText(text: string): boolean {
|
||||
|
|
@ -49,6 +51,7 @@ export type IPost = {
|
|||
heading: number;
|
||||
speed: number;
|
||||
};
|
||||
uri: string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue