service -> serviceId
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
dist
|
dist
|
||||||
node_modules/*
|
node_modules/*
|
||||||
.env
|
.env
|
||||||
|
.log
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
stats.json
|
stats.json
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
@ -18,7 +18,7 @@ class Integration extends BaseModel {
|
|||||||
ui: UiStore;
|
ui: UiStore;
|
||||||
|
|
||||||
id: string;
|
id: string;
|
||||||
serviceId: string;
|
service: string;
|
||||||
collectionId: string;
|
collectionId: string;
|
||||||
events: Events;
|
events: Events;
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
|
@ -23,7 +23,7 @@ class IntegrationsStore extends BaseStore {
|
|||||||
|
|
||||||
@computed
|
@computed
|
||||||
get slackIntegrations(): Integration[] {
|
get slackIntegrations(): Integration[] {
|
||||||
return _.filter(this.orderedData, { serviceId: 'slack' });
|
return _.filter(this.orderedData, { service: 'slack' });
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
@ -20,7 +20,7 @@ router.post('hooks.unfurl', async ctx => {
|
|||||||
if (!user) return;
|
if (!user) return;
|
||||||
|
|
||||||
const auth = await Authentication.find({
|
const auth = await Authentication.find({
|
||||||
where: { serviceId: 'slack', teamId: user.teamId },
|
where: { service: 'slack', teamId: user.teamId },
|
||||||
});
|
});
|
||||||
if (!auth) return;
|
if (!auth) return;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ describe('#hooks.unfurl', async () => {
|
|||||||
it('should return documents', async () => {
|
it('should return documents', async () => {
|
||||||
const { user, document } = await seed();
|
const { user, document } = await seed();
|
||||||
await Authentication.create({
|
await Authentication.create({
|
||||||
serviceId: 'slack',
|
service: 'slack',
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
token: '',
|
token: '',
|
||||||
|
@ -52,8 +52,6 @@ describe('#team.update', async () => {
|
|||||||
const res = await server.post('/api/team.update', {
|
const res = await server.post('/api/team.update', {
|
||||||
body: { token: user.getJwtToken(), name: 'New name' },
|
body: { token: user.getJwtToken(), name: 'New name' },
|
||||||
});
|
});
|
||||||
const body = await res.json();
|
|
||||||
|
|
||||||
expect(res.status).toEqual(403);
|
expect(res.status).toEqual(403);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ router.get('slack.commands', async ctx => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const authentication = await Authentication.create({
|
const authentication = await Authentication.create({
|
||||||
serviceId: 'slack',
|
service: 'slack',
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
token: data.access_token,
|
token: data.access_token,
|
||||||
@ -94,7 +94,7 @@ router.get('slack.commands', async ctx => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await Integration.create({
|
await Integration.create({
|
||||||
serviceId: 'slack',
|
service: 'slack',
|
||||||
type: 'command',
|
type: 'command',
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
@ -120,7 +120,7 @@ router.get('slack.post', async ctx => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const authentication = await Authentication.create({
|
const authentication = await Authentication.create({
|
||||||
serviceId: 'slack',
|
service: 'slack',
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
token: data.access_token,
|
token: data.access_token,
|
||||||
@ -128,7 +128,7 @@ router.get('slack.post', async ctx => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await Integration.create({
|
await Integration.create({
|
||||||
serviceId: 'slack',
|
service: 'slack',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
|
10
server/migrations/20180528233910-rename-serviceid.js
Normal file
10
server/migrations/20180528233910-rename-serviceid.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
up: async (queryInterface, Sequelize) => {
|
||||||
|
await queryInterface.renameColumn('authentications', 'serviceId', 'service');
|
||||||
|
await queryInterface.renameColumn('integrations', 'serviceId', 'service');
|
||||||
|
},
|
||||||
|
down: async (queryInterface, Sequelize) => {
|
||||||
|
await queryInterface.renameColumn('authentications', 'service', 'serviceId');
|
||||||
|
await queryInterface.renameColumn('integrations', 'service', 'serviceId');
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,7 @@ const Authentication = sequelize.define('authentication', {
|
|||||||
defaultValue: DataTypes.UUIDV4,
|
defaultValue: DataTypes.UUIDV4,
|
||||||
primaryKey: true,
|
primaryKey: true,
|
||||||
},
|
},
|
||||||
serviceId: DataTypes.STRING,
|
service: DataTypes.STRING,
|
||||||
scopes: DataTypes.ARRAY(DataTypes.STRING),
|
scopes: DataTypes.ARRAY(DataTypes.STRING),
|
||||||
token: encryptedFields.vault('token'),
|
token: encryptedFields.vault('token'),
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,7 @@ const Integration = sequelize.define('integration', {
|
|||||||
primaryKey: true,
|
primaryKey: true,
|
||||||
},
|
},
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
serviceId: DataTypes.STRING,
|
service: DataTypes.STRING,
|
||||||
settings: DataTypes.JSONB,
|
settings: DataTypes.JSONB,
|
||||||
events: DataTypes.ARRAY(DataTypes.STRING),
|
events: DataTypes.ARRAY(DataTypes.STRING),
|
||||||
});
|
});
|
||||||
|
@ -7,9 +7,9 @@ function present(ctx: Object, integration: Integration) {
|
|||||||
type: integration.type,
|
type: integration.type,
|
||||||
userId: integration.userId,
|
userId: integration.userId,
|
||||||
teamId: integration.teamId,
|
teamId: integration.teamId,
|
||||||
serviceId: integration.serviceId,
|
|
||||||
collectionId: integration.collectionId,
|
collectionId: integration.collectionId,
|
||||||
authenticationId: integration.authenticationId,
|
authenticationId: integration.authenticationId,
|
||||||
|
service: integration.service,
|
||||||
events: integration.events,
|
events: integration.events,
|
||||||
settings: integration.settings,
|
settings: integration.settings,
|
||||||
createdAt: integration.createdAt,
|
createdAt: integration.createdAt,
|
||||||
|
@ -14,8 +14,8 @@ const Slack = {
|
|||||||
const integration = await Integration.findOne({
|
const integration = await Integration.findOne({
|
||||||
where: {
|
where: {
|
||||||
teamId: document.teamId,
|
teamId: document.teamId,
|
||||||
serviceId: 'slack',
|
|
||||||
collectionId: document.atlasId,
|
collectionId: document.atlasId,
|
||||||
|
service: 'slack',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user