mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-16 10:19:10 +00:00
chore: remove semi
This commit is contained in:
parent
4b75eaa0ab
commit
8fcc0dcbf9
64 changed files with 1073 additions and 1073 deletions
|
@ -1,40 +1,40 @@
|
|||
const Service = require('./Service');
|
||||
const Service = require('./Service')
|
||||
|
||||
class SessionsService extends Service {
|
||||
constructor(ctx) {
|
||||
super(ctx);
|
||||
this.Session = ctx.M.Session;
|
||||
super(ctx)
|
||||
this.Session = ctx.M.Session
|
||||
}
|
||||
|
||||
async get(id, { rolling }) {
|
||||
const user = await this.Session.findOne({ where: { id } });
|
||||
const user = await this.Session.findOne({ where: { id } })
|
||||
|
||||
if (user === null) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
|
||||
return user.data;
|
||||
return user.data
|
||||
}
|
||||
|
||||
async set(id, data, { maxAge, rolling, changed }) {
|
||||
let session = await this.Session.findOne({ where: { id } });
|
||||
let session = await this.Session.findOne({ where: { id } })
|
||||
if (session === null) {
|
||||
session = this.Session.build({ id });
|
||||
session = this.Session.build({ id })
|
||||
}
|
||||
|
||||
session.data = data;
|
||||
session.maxAge = maxAge;
|
||||
session.data = data
|
||||
session.maxAge = maxAge
|
||||
|
||||
return session.save();
|
||||
return session.save()
|
||||
}
|
||||
|
||||
async destroy(id) {
|
||||
const sess = await this.Session.findOne({ where: { id } });
|
||||
const sess = await this.Session.findOne({ where: { id } })
|
||||
|
||||
if (sess != null) {
|
||||
return sess.destroy();
|
||||
return sess.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SessionsService;
|
||||
module.exports = SessionsService
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue