finally got the associations to work through black magic
This commit is contained in:
+25
-11
@@ -1,15 +1,29 @@
|
||||
import { User } from './User';
|
||||
import { Auth } from './Auth';
|
||||
import { UserPerms } from './UserPerms';
|
||||
import { Post } from './Post';
|
||||
import { Tag } from './Tag';
|
||||
import { Attachment } from './Attachment';
|
||||
import { Bucket } from './Bucket';
|
||||
import { DBState } from './DBState';
|
||||
import { Post, PostBucket } from './Post';
|
||||
import { PostTag } from './PostTag';
|
||||
import { Project } from './Project';
|
||||
import { Tag } from './Tag';
|
||||
import { User, addUserScopes } from './User';
|
||||
import { UserPerms, addUserPermsScopes } from './UserPerms';
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
import Sequelize from '@sequelize/core';
|
||||
|
||||
User.sync();
|
||||
Auth.sync();
|
||||
UserPerms.sync();
|
||||
PostTag.sync();
|
||||
Tag.sync();
|
||||
Post.sync();
|
||||
|
||||
export { User, Auth, UserPerms, Post, Tag, PostTag }
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [Auth, Attachment, Bucket, DBState, Post, PostBucket, PostTag, Project, Tag, User, UserPerms],
|
||||
|
||||
});
|
||||
|
||||
|
||||
const dbSync = (async ()=> await sequelize.sync())().then(()=>{
|
||||
addUserScopes();
|
||||
addUserPermsScopes();
|
||||
});
|
||||
|
||||
|
||||
export { sequelize, dbSync, Auth, Attachment, Bucket, DBState, Post, PostBucket, PostTag, Project, Tag, User, UserPerms }
|
||||
Reference in New Issue
Block a user