Massive cleanup
Functionnal basic API calls for spells Cleaned up some functions Moved some files around
This commit is contained in:
@@ -3,7 +3,6 @@ import { DataTypes, Model, Optional } from "sequelize";
|
||||
import { AuracleDatabaseDriver } from "../../AuracleDatabaseDriver";
|
||||
|
||||
interface IngredientAttributes {
|
||||
id: number
|
||||
uuid: string
|
||||
name: string
|
||||
description: string
|
||||
@@ -11,10 +10,9 @@ interface IngredientAttributes {
|
||||
published: boolean
|
||||
}
|
||||
|
||||
interface IngredientCreationAttributes extends Optional<IngredientAttributes, 'id'> { }
|
||||
interface IngredientCreationAttributes extends Optional<IngredientAttributes, 'uuid'> { }
|
||||
|
||||
export class Ingredient extends Model<IngredientAttributes, IngredientCreationAttributes> implements IngredientAttributes {
|
||||
public readonly id!: number
|
||||
public readonly uuid!: string
|
||||
public name!: string
|
||||
public description!: string
|
||||
@@ -28,16 +26,12 @@ export class Ingredient extends Model<IngredientAttributes, IngredientCreationAt
|
||||
export default () => {
|
||||
Ingredient.init(
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.INTEGER.UNSIGNED,
|
||||
autoIncrement: true,
|
||||
primaryKey: true
|
||||
},
|
||||
uuid: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
defaultValue: DataTypes.UUIDV4
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
@@ -55,7 +49,7 @@ export default () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
tableName: 'ingredients',
|
||||
tableName: 'au_ingredients',
|
||||
sequelize: AuracleDatabaseDriver,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -3,7 +3,6 @@ import { DataTypes, Model, Optional } from "sequelize";
|
||||
import { AuracleDatabaseDriver } from "../../AuracleDatabaseDriver";
|
||||
|
||||
interface MetaSchoolAttributes {
|
||||
id: number
|
||||
uuid: string
|
||||
name: string
|
||||
description: string
|
||||
@@ -11,10 +10,9 @@ interface MetaSchoolAttributes {
|
||||
published: boolean
|
||||
}
|
||||
|
||||
interface MetaSchoolCreationAttributes extends Optional<MetaSchoolAttributes, 'id'> { }
|
||||
interface MetaSchoolCreationAttributes extends Optional<MetaSchoolAttributes, 'uuid'> { }
|
||||
|
||||
export class MetaSchool extends Model<MetaSchoolAttributes, MetaSchoolCreationAttributes> implements MetaSchoolAttributes {
|
||||
public readonly id!: number
|
||||
public readonly uuid!: string
|
||||
public name!: string
|
||||
public description!: string
|
||||
@@ -28,16 +26,12 @@ export class MetaSchool extends Model<MetaSchoolAttributes, MetaSchoolCreationAt
|
||||
export default () => {
|
||||
MetaSchool.init(
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.INTEGER.UNSIGNED,
|
||||
autoIncrement: true,
|
||||
primaryKey: true
|
||||
},
|
||||
uuid: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
defaultValue: DataTypes.UUIDV4
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
@@ -55,7 +49,7 @@ export default () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
tableName: 'meta_schools',
|
||||
tableName: 'au_meta_schools',
|
||||
sequelize: AuracleDatabaseDriver,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -3,7 +3,6 @@ import { DataTypes, Model, Optional } from "sequelize";
|
||||
import { AuracleDatabaseDriver } from "../../AuracleDatabaseDriver";
|
||||
|
||||
interface SchoolAttributes {
|
||||
id: number
|
||||
uuid: string
|
||||
name: string
|
||||
description: string
|
||||
@@ -11,10 +10,9 @@ interface SchoolAttributes {
|
||||
published: boolean
|
||||
}
|
||||
|
||||
interface SchoolCreationAttributes extends Optional<SchoolAttributes, 'id'> { }
|
||||
interface SchoolCreationAttributes extends Optional<SchoolAttributes, 'uuid'> { }
|
||||
|
||||
export class School extends Model<SchoolAttributes, SchoolCreationAttributes> implements SchoolAttributes {
|
||||
public readonly id!: number
|
||||
public readonly uuid!: string
|
||||
public name!: string
|
||||
public description!: string
|
||||
@@ -28,16 +26,12 @@ export class School extends Model<SchoolAttributes, SchoolCreationAttributes> im
|
||||
export default () => {
|
||||
School.init(
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.INTEGER.UNSIGNED,
|
||||
autoIncrement: true,
|
||||
primaryKey: true
|
||||
},
|
||||
uuid: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
defaultValue: DataTypes.UUIDV4
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
@@ -55,7 +49,7 @@ export default () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
tableName: 'schools',
|
||||
tableName: 'au_schools',
|
||||
sequelize: AuracleDatabaseDriver,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1,55 +1,49 @@
|
||||
import { DataTypes, Model, Optional } from "sequelize";
|
||||
import { DataTypes, Model, Optional, TableHints } from "sequelize";
|
||||
|
||||
import { AuracleDatabaseDriver } from "../../AuracleDatabaseDriver";
|
||||
|
||||
interface SpellAttributes {
|
||||
id: number
|
||||
uuid: string
|
||||
name: string
|
||||
description: string
|
||||
|
||||
level: number
|
||||
charge: number
|
||||
cost: string
|
||||
isRitual: boolean
|
||||
level?: number
|
||||
charge?: number
|
||||
cost?: string
|
||||
isRitual?: boolean
|
||||
|
||||
published: boolean
|
||||
public: boolean
|
||||
published?: boolean
|
||||
public?: boolean
|
||||
}
|
||||
|
||||
interface SpellCreationAttributes extends Optional<SpellAttributes, 'id'> { }
|
||||
export interface SpellCreationAttributes extends Optional<SpellAttributes, 'uuid'> { }
|
||||
|
||||
export class SpellModel extends Model<SpellAttributes, SpellCreationAttributes> implements SpellAttributes {
|
||||
public readonly id!: number
|
||||
export class Spell extends Model<SpellAttributes, SpellCreationAttributes> implements SpellAttributes {
|
||||
public readonly uuid!: string
|
||||
public name!: string
|
||||
public description!: string
|
||||
|
||||
public level: number
|
||||
public charge: number
|
||||
public cost: string
|
||||
public isRitual: boolean
|
||||
public level?: number
|
||||
public charge?: number
|
||||
public cost?: string
|
||||
public isRitual?: boolean
|
||||
|
||||
public published: boolean
|
||||
public public: boolean
|
||||
public published?: boolean
|
||||
public public?: boolean
|
||||
|
||||
public readonly createdAt!: Date;
|
||||
public readonly updatedAt!: Date;
|
||||
}
|
||||
|
||||
export default () => {
|
||||
SpellModel.init(
|
||||
export default async () => {
|
||||
Spell.init(
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.INTEGER.UNSIGNED,
|
||||
autoIncrement: true,
|
||||
primaryKey: true
|
||||
},
|
||||
uuid: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
defaultValue: DataTypes.UUIDV4
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
@@ -88,7 +82,7 @@ export default () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
tableName: 'spells',
|
||||
tableName: 'au_spells',
|
||||
sequelize: AuracleDatabaseDriver,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -3,17 +3,15 @@ import { DataTypes, Model, Optional } from "sequelize";
|
||||
import { AuracleDatabaseDriver } from "../../AuracleDatabaseDriver";
|
||||
|
||||
interface VariableAttributes {
|
||||
id: number
|
||||
uuid: string
|
||||
description: string
|
||||
|
||||
published: boolean
|
||||
}
|
||||
|
||||
interface VariableCreationAttributes extends Optional<VariableAttributes, 'id'> { }
|
||||
interface VariableCreationAttributes extends Optional<VariableAttributes, 'uuid'> { }
|
||||
|
||||
export class Variable extends Model<VariableAttributes, VariableCreationAttributes> implements VariableAttributes {
|
||||
public readonly id!: number
|
||||
public readonly uuid!: string
|
||||
public description!: string
|
||||
|
||||
@@ -26,16 +24,12 @@ export class Variable extends Model<VariableAttributes, VariableCreationAttribut
|
||||
export default () => {
|
||||
Variable.init(
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.INTEGER.UNSIGNED,
|
||||
autoIncrement: true,
|
||||
primaryKey: true
|
||||
},
|
||||
uuid: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
defaultValue: DataTypes.UUIDV4
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
description: {
|
||||
type: DataTypes.STRING,
|
||||
@@ -48,7 +42,7 @@ export default () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
tableName: 'variables',
|
||||
tableName: 'au_variables',
|
||||
sequelize: AuracleDatabaseDriver,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user