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