mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-03 19:43:04 +08:00
[local-sync] make syncbackRequest objects N1-ready
This commit is contained in:
parent
b36f61812d
commit
b06566d8bd
2 changed files with 7 additions and 2 deletions
|
@ -3,6 +3,8 @@ const Serialization = require('./serialization');
|
|||
module.exports = {
|
||||
createSyncbackRequest: function createSyncbackRequest(request, reply, syncRequestArgs) {
|
||||
request.getAccountDatabase().then((db) => {
|
||||
const accountId = request.auth.credentials.id;
|
||||
syncRequestArgs.accountId = accountId
|
||||
db.SyncbackRequest.create(syncRequestArgs).then((syncbackRequest) => {
|
||||
reply(Serialization.jsonStringify(syncbackRequest))
|
||||
})
|
||||
|
|
|
@ -10,15 +10,18 @@ module.exports = (sequelize, Sequelize) => {
|
|||
},
|
||||
error: JSONType('error'),
|
||||
props: JSONType('props'),
|
||||
accountId: { type: Sequelize.STRING, allowNull: false },
|
||||
}, {
|
||||
instanceMethods: {
|
||||
toJSON: function toJSON() {
|
||||
return {
|
||||
id: `${this.id}`,
|
||||
type: this.type,
|
||||
status: this.status,
|
||||
error: this.error,
|
||||
error: JSON.stringify(this.error || {}),
|
||||
props: this.props,
|
||||
status: this.status,
|
||||
object: 'providerSyncbackRequest',
|
||||
account_id: this.accountId,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue