This commit is contained in:
2024-03-18 19:42:44 +01:00
parent 838c2df336
commit b1eb3cb9a6
31 changed files with 2592 additions and 1908 deletions
-56
View File
@@ -1,56 +0,0 @@
import Gens from "@/gens";
import { Sequelize, DataTypes, Association, UUIDV4 } from 'sequelize';
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: 'db.sqlite'
});
export const MPost = sequelize.define('Post', {
id: {
type: DataTypes.INTEGER,
primaryKey: true
},
title: DataTypes.STRING,
content: DataTypes.STRING,
// date: DataTypes.DATE,
});
export const MAuth = sequelize.define('Auth', {
id: {
type: DataTypes.INTEGER,
primaryKey: true
},
token: {
type: DataTypes.UUID,
defaultValue: UUIDV4
},
user_id: {
type: DataTypes.INTEGER,
key: "User"
}
// date: DataTypes.DATE,
});
export const MUser = sequelize.define('User', {
id: {
type: DataTypes.INTEGER,
primaryKey: true
},
username: DataTypes.STRING,
password: DataTypes.STRING,
// date: DataTypes.DATE,
});
MAuth.hasOne(MUser)
export type Post = {
id: Number,
title: String,
content: String,
date?: String,
}
export const postPlaceholder:Post = {
id: -1,
title: 'Lorem Ipsum',
content: Gens.loremipsum()
};