chore(xo-server/remotes): inline Remotes#create()

This commit is contained in:
Julien Fontanet
2018-08-14 16:36:47 +02:00
parent 76f75401ee
commit 4ba542b70f
2 changed files with 6 additions and 12 deletions

View File

@@ -11,17 +11,6 @@ export class Remotes extends Collection {
return Remote
}
create (name, url) {
return this.add(
new Remote({
name,
url,
enabled: false,
error: '',
})
)
}
async get (properties) {
const remotes = await super.get(properties)
forEach(remotes, remote => {

View File

@@ -83,7 +83,12 @@ export default class {
}
async createRemote ({ name, url }) {
const remote = await this._remotes.create(name, url)
const remote = await this._remotes.add({
name,
url,
enabled: false,
error: '',
})
return /* await */ this.updateRemote(remote.get('id'), { enabled: true })
}