mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-04 23:19:42 +00:00
PlaybackSession, Playlist, PlaylistMediaItem, Device data models
This commit is contained in:
parent
a1a923df94
commit
bed3758268
9 changed files with 231 additions and 25 deletions
29
server/models/Device.js
Normal file
29
server/models/Device.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue