From 7dd2a077e5d70fe723690f53f6f7f199bb0e113f Mon Sep 17 00:00:00 2001 From: Julien Gautier Date: Sat, 25 Apr 2026 17:22:08 +0200 Subject: [PATCH] chore(models): remove unused Product-tmp.js Leftover scratch file, not registered in src/database/mysql.js and not referenced anywhere in src/ or scripts/. --- src/database/models/mysql/Product-tmp.js | 82 ------------------------ 1 file changed, 82 deletions(-) delete mode 100644 src/database/models/mysql/Product-tmp.js diff --git a/src/database/models/mysql/Product-tmp.js b/src/database/models/mysql/Product-tmp.js deleted file mode 100644 index 49ad1b1..0000000 --- a/src/database/models/mysql/Product-tmp.js +++ /dev/null @@ -1,82 +0,0 @@ -const { DataTypes, Model } = require("sequelize"); -const sequelize = require("../../config/sequelize"); -const slug = require("slug"); - -class Product extends Model { } - -const ProductModel = () => { - Product.init( - { - id: { - autoIncrement: true, - type: DataTypes.INTEGER, - allowNull: false, - primaryKey: true - }, - slug: { - type: DataTypes.STRING(255), - allowNull: false - }, - title: { - type: DataTypes.STRING(255), - allowNull: false - }, - description: { - type: DataTypes.TEXT, - allowNull: true - }, - body: { - type: DataTypes.TEXT, - allowNull: false - }, - authorId: { - type: DataTypes.STRING(24), - allowNull: true, - references: { - model: 'user', - key: 'id' - } - } - }, - { - sequelize, - tableName: 'product', - timestamps: true, - indexes: [ - { - name: "PRIMARY", - unique: true, - using: "BTREE", - fields: [ - { name: "id" }, - ] - }, - { - name: "authorId", - using: "BTREE", - fields: [ - { name: "authorId" }, - ] - }, - ] - } - ); - - Product.beforeValidate((product) => { - product.slug = slug(`${product.title}`) + '-' + (Math.random() * Math.pow(36, 6) | 0).toString(36); - }); - - Product.prototype.toJSONFor = function () { - return { - id: this.id, - slug: this.slug, - title: this.title, - description: this.description, - body: this.body - }; - }; - - return Product; -}; - -module.exports = ProductModel;