mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
29 lines
733 B
JavaScript
29 lines
733 B
JavaScript
const { DataTypes, Model } = require('sequelize')
|
|
|
|
module.exports = (sequelize) => {
|
|
class Device extends Model { }
|
|
|
|
Device.init({
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
identifier: DataTypes.STRING,
|
|
clientName: DataTypes.STRING, // e.g. Abs Web, Abs Android
|
|
clientVersion: DataTypes.STRING,
|
|
ipAddress: DataTypes.STRING,
|
|
deviceName: DataTypes.STRING, // e.g. Windows 10 Chrome, Google Pixel 6, Apple iPhone 10,3
|
|
deviceVersion: DataTypes.STRING // e.g. Browser version or Android SDK
|
|
}, {
|
|
sequelize,
|
|
modelName: 'device'
|
|
})
|
|
|
|
const { user } = sequelize.models
|
|
|
|
user.hasMany(Device)
|
|
Device.belongsTo(user)
|
|
|
|
return Device
|
|
} |