Yea
This commit is contained in:
@@ -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()
|
||||
};
|
||||
Reference in New Issue
Block a user