finally got the associations to work through black magic
This commit is contained in:
+4
-9
@@ -1,4 +1,4 @@
|
||||
import { Association, BelongsToGetAssociationMixin, BelongsToManyGetAssociationsMixin, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize, sql } from "@sequelize/core";
|
||||
import { Association, BelongsToGetAssociationMixin, BelongsToManyAddAssociationMixin, BelongsToManyCreateAssociationMixin, BelongsToManyGetAssociationsMixin, BelongsToManyRemoveAssociationMixin, BelongsToManySetAssociationsMixin, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize, sql } from "@sequelize/core";
|
||||
import { Post } from "./Post";
|
||||
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
@@ -14,19 +14,14 @@ export class Bucket extends Model<InferAttributes<Bucket>, InferCreationAttribut
|
||||
declare id: UUID
|
||||
|
||||
/** Defined by {@link Post.buckets} */
|
||||
declare bucketPosts?:NonAttribute<Post>[];
|
||||
declare posts?:NonAttribute<Post>[];
|
||||
|
||||
|
||||
/** Defined by {@link Attachment.bucket} */
|
||||
declare attachments?:NonAttribute<Attachment>[];
|
||||
|
||||
declare static associations: {
|
||||
bucketPosts: Association<Post, Bucket>;
|
||||
posts: Association<Post, Bucket>;
|
||||
attachments: Association<Attachment, Bucket>;
|
||||
};
|
||||
}
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: SqliteDialect,
|
||||
storage: 'db.sqlite',
|
||||
models: [Bucket]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user