kannon/models/Album.js

28 lines
535 B
JavaScript
Raw Permalink Normal View History

2022-06-03 17:04:44 +02:00
const path = require('path');
2022-04-14 14:23:41 +02:00
const { DataTypes } = require('sequelize');
2022-06-03 17:04:44 +02:00
const Base = require('./Base.js');
2022-04-14 14:23:41 +02:00
2022-06-03 17:04:44 +02:00
const tableName = path.basename(__filename, '.js').toLowerCase();
2022-06-03 14:52:35 +02:00
2022-06-03 17:04:44 +02:00
class Album extends Base {
2022-06-03 14:52:35 +02:00
2022-06-03 17:04:44 +02:00
constructor(name) {
super();
this.tableName = tableName;
this.name = name;
2022-06-03 14:52:35 +02:00
}
2022-06-03 17:04:44 +02:00
isValid() {
return this.name !== undefined;
}
2022-06-03 14:52:35 +02:00
2022-06-03 17:04:44 +02:00
async getModel() {
return database.connection.define(tableName, {
name: DataTypes.TEXT
});
}
2022-06-03 14:52:35 +02:00
}
2022-06-03 17:04:44 +02:00
module.exports = Album;