Working state for attachments and buckets
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { Association, BelongsToGetAssociationMixin, BelongsToManyGetAssociationsMixin, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize, sql } from "@sequelize/core";
|
||||
import { Post } from "./Post";
|
||||
|
||||
import { SqliteDialect } from '@sequelize/sqlite3';
|
||||
import { Attribute, AutoIncrement, BelongsTo, BelongsToMany, Default, NotNull, PrimaryKey, Unique } from "@sequelize/core/decorators-legacy";
|
||||
import { Attachment } from "./Attachment";
|
||||
import { UUID } from "crypto";
|
||||
|
||||
export class Bucket extends Model<InferAttributes<Bucket>, InferCreationAttributes<Bucket>> {
|
||||
@PrimaryKey
|
||||
@Unique
|
||||
@Attribute(DataTypes.UUIDV4)
|
||||
@Default(sql.uuidV4)
|
||||
declare id: UUID
|
||||
|
||||
/** Defined by {@link Post.buckets} */
|
||||
declare bucketPosts?:NonAttribute<Post>[];
|
||||
|
||||
/** Defined by {@link Attachment.bucket} */
|
||||
declare attachments?:NonAttribute<Attachment>[];
|
||||
|
||||
declare static associations: {
|
||||
bucketPosts: 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