Buncha changes I CBA

This commit is contained in:
2024-03-21 09:46:39 +01:00
parent 2764039835
commit 89f3f86c54
12 changed files with 146 additions and 136 deletions
+16 -5
View File
@@ -42,12 +42,22 @@ Auth.init({
sequelize // passing the `sequelize` instance is required
});
export type PostAttributes = {
id: number;
title: string;
content: string;
date: number;
user_id:ForeignKey<User['id']>;
}
export type PostCreationAttributes = {
title: string;
content: string;
date: number;
user_id:number;
}
export class Post extends Model<InferAttributes<Post>, InferCreationAttributes<Post>> {
declare id: number|null;
declare title: string;
declare content: string;
declare date: number;
export class Post extends Model<PostAttributes, PostCreationAttributes> {
declare id: number;
declare user:NonAttribute<User>;
declare user_id:ForeignKey<User['id']>;
declare getUser: BelongsToGetAssociationMixin<User>;
@@ -73,6 +83,7 @@ Post.init(
date: {
type: DataTypes.DATE
},
},
{
tableName: 'Posts',