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,16 +1,16 @@
|
|||
const Service = require('./Service');
|
||||
const Service = require('./Service')
|
||||
|
||||
class ServerService extends Service {
|
||||
constructor(ctx) {
|
||||
super(ctx);
|
||||
this.Server = ctx.M.Server;
|
||||
this.P = ctx.P;
|
||||
super(ctx)
|
||||
this.Server = ctx.M.Server
|
||||
this.P = ctx.P
|
||||
}
|
||||
|
||||
async ensure(server) {
|
||||
let srv;
|
||||
let srv
|
||||
try {
|
||||
srv = await this.get(server.id);
|
||||
srv = await this.get(server.id)
|
||||
} catch (e) {}
|
||||
|
||||
if (srv == null) {
|
||||
|
@ -18,20 +18,20 @@ class ServerService extends Service {
|
|||
id: server.id,
|
||||
message: '',
|
||||
categories: {},
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
create({ id, message, categories }) {
|
||||
const srv = this.Server.build({ id, message, categories });
|
||||
const srv = this.Server.build({ id, message, categories })
|
||||
|
||||
return srv.save();
|
||||
return srv.save()
|
||||
}
|
||||
|
||||
async update(id, newData) {
|
||||
const srv = await this.get(id, false);
|
||||
const srv = await this.get(id, false)
|
||||
|
||||
return srv.update(newData);
|
||||
return srv.update(newData)
|
||||
}
|
||||
|
||||
async get(id, plain = true) {
|
||||
|
@ -39,26 +39,26 @@ class ServerService extends Service {
|
|||
where: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
if (!plain) {
|
||||
return s;
|
||||
return s
|
||||
}
|
||||
|
||||
return s.get({ plain: true });
|
||||
return s.get({ plain: true })
|
||||
}
|
||||
|
||||
async getAllowedRoles(id) {
|
||||
const server = await this.get(id);
|
||||
const server = await this.get(id)
|
||||
|
||||
return Object.values(server.categories).reduce((acc, c) => {
|
||||
if (c.hidden !== true) {
|
||||
return acc.concat(c.roles);
|
||||
return acc.concat(c.roles)
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
return acc
|
||||
}, [])
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ServerService;
|
||||
module.exports = ServerService
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue