chore: remove semi

This commit is contained in:
Katie Thornhill 2019-11-19 23:06:33 -05:00
parent 4b75eaa0ab
commit 8fcc0dcbf9
No known key found for this signature in database
GPG key ID: F76EDC6541A99644
64 changed files with 1073 additions and 1073 deletions

View file

@ -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