mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-07 05:04:58 +08:00
[local-sync]: Add distinct ids to folders and labels
This commit is contained in:
parent
209122c346
commit
8939364dc3
5 changed files with 7 additions and 3 deletions
|
@ -72,7 +72,7 @@ module.exports = (server) => {
|
|||
tags: [term],
|
||||
validate: {
|
||||
params: {
|
||||
id: Joi.number().integer(),
|
||||
id: Joi.string(),
|
||||
},
|
||||
},
|
||||
response: {
|
||||
|
|
|
@ -35,7 +35,7 @@ function jsonSchema(modelName) {
|
|||
}
|
||||
if (modelName === 'Folder') {
|
||||
return Joi.object().keys({
|
||||
id: Joi.number(),
|
||||
id: Joi.string(),
|
||||
object: Joi.string(),
|
||||
account_id: Joi.string(),
|
||||
name: Joi.string().allow(null),
|
||||
|
@ -44,7 +44,7 @@ function jsonSchema(modelName) {
|
|||
}
|
||||
if (modelName === 'Label') {
|
||||
return Joi.object().keys({
|
||||
id: Joi.number(),
|
||||
id: Joi.string(),
|
||||
object: Joi.string(),
|
||||
account_id: Joi.string(),
|
||||
name: Joi.string().allow(null),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const crypto = require('crypto')
|
||||
const {Provider, PromiseUtils} = require('isomorphic-core');
|
||||
const {localizedCategoryNames} = require('../sync-utils')
|
||||
|
||||
|
@ -93,6 +94,7 @@ class FetchFolderList {
|
|||
const role = this._roleByAttr(box);
|
||||
const Klass = this._classForMailboxWithRole(role, this._db);
|
||||
category = Klass.build({
|
||||
id: crypto.createHash('sha256').update(boxName, 'utf8').digest('hex'),
|
||||
name: boxName,
|
||||
accountId: this._db.accountId,
|
||||
role: role,
|
||||
|
|
|
@ -2,6 +2,7 @@ const {DatabaseTypes: {JSONType}} = require('isomorphic-core');
|
|||
|
||||
module.exports = (sequelize, Sequelize) => {
|
||||
return sequelize.define('folder', {
|
||||
id: { type: Sequelize.STRING(65), primaryKey: true },
|
||||
accountId: { type: Sequelize.STRING, allowNull: false },
|
||||
version: Sequelize.INTEGER,
|
||||
name: Sequelize.STRING,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = (sequelize, Sequelize) => {
|
||||
return sequelize.define('label', {
|
||||
id: { type: Sequelize.STRING(65), primaryKey: true },
|
||||
accountId: { type: Sequelize.STRING, allowNull: false },
|
||||
version: Sequelize.INTEGER,
|
||||
name: Sequelize.STRING,
|
||||
|
|
Loading…
Add table
Reference in a new issue