Added session & session manager

This commit is contained in:
Tom
2024-12-05 01:05:58 +00:00
parent 1b91e330c1
commit 478bd76aeb
2 changed files with 77 additions and 0 deletions

44
models/session.js Normal file
View File

@ -0,0 +1,44 @@
class Session {
constructor(id) {
this._id = id;
this._started = Date.now();
this._current = null;
this._previous = null;
this._lastScrobble = null;
this._pauseDuration = 0;
}
get id() {
return this._id;
}
get playing() {
return this._current;
}
set playing(value) {
this._current = value;
}
get started() {
return this._started;
}
get lastScrobbleTimestamp() {
return this._lastScrobble;
}
set lastScrobbleTimestamp(value) {
this._lastScrobble = value;
}
get pauseDuration() {
return this._pauseDuration;
}
set pauseDuration(value) {
this._pauseDuration = value;
}
}
module.exports = Session;