mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-15 06:06:35 +08:00
31 lines
816 B
JavaScript
31 lines
816 B
JavaScript
|
const Joi = require('joi');
|
||
|
const {DatabaseConnector} = require(`nylas-core`);
|
||
|
|
||
|
module.exports = (server) => {
|
||
|
server.route({
|
||
|
method: 'PUT',
|
||
|
path: '/accounts/{accountId}/clear-sync-error',
|
||
|
config: {
|
||
|
description: 'Clears the sync error for the given account',
|
||
|
notes: 'Notes go here',
|
||
|
tags: ['accounts', 'sync-error'],
|
||
|
validate: {
|
||
|
params: {
|
||
|
accountId: Joi.number().integer(),
|
||
|
},
|
||
|
},
|
||
|
response: {
|
||
|
schema: Joi.string(),
|
||
|
},
|
||
|
},
|
||
|
handler: (request, reply) => {
|
||
|
DatabaseConnector.forShared().then(({Account}) => {
|
||
|
Account.find({where: {id: request.params.accountId}}).then((account) => {
|
||
|
account.syncError = null;
|
||
|
account.save().then(() => reply("Success"));
|
||
|
})
|
||
|
})
|
||
|
},
|
||
|
});
|
||
|
};
|