Skip to content

Commit 7ed3481

Browse files
committed
remove
1 parent 9a0fc08 commit 7ed3481

8 files changed

Lines changed: 15 additions & 23 deletions

File tree

jest.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ module.exports = {
3737
moduleNameMapper: {
3838
'^node:crypto$': '<rootDir>/test/__mocks__/node_crypto.js',
3939
'^node:util$': '<rootDir>/test/__mocks__/node_util.js',
40-
/**
41-
* demoWorkspace is TypeScript; CommonJS resolvers use require() without extension
42-
*/
43-
'^.+/constants/demoWorkspace$': '<rootDir>/src/constants/demoWorkspace.ts',
4440
},
4541

4642
/**

src/constants/demoWorkspace.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/integrations/github/routes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import ProjectModel from '../../models/project';
1111
import WorkspaceModel from '../../models/workspace';
1212
import { sgr, Effect } from '../../utils/ansi';
1313
import { databases } from '../../mongo';
14-
import { DEMO_WORKSPACE_ID } from '../../constants/demoWorkspace';
1514

1615
/**
1716
* Default task threshold for automatic task creation
@@ -109,7 +108,7 @@ export function createGitHubRouter(factories: ContextFactories): express.Router
109108
/**
110109
* Check if project is demo project (cannot be modified)
111110
*/
112-
if (project.workspaceId.toString() === DEMO_WORKSPACE_ID) {
111+
if (project.workspaceId.toString() === '6213b6a01e6281087467cc7a') {
113112
res.status(400).json({ error: 'Unable to update demo project' });
114113

115114
return null;

src/resolvers/event.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const getEventsFactory = require('./helpers/eventsFactory').default;
22
const sendPersonalNotification = require('../utils/personalNotifications').default;
33
const { aiService } = require('../services/ai');
4-
const { DEMO_WORKSPACE_ID } = require('../constants/demoWorkspace');
54
const { UserInputError } = require('apollo-server-express');
65

76
/**
@@ -50,7 +49,7 @@ module.exports = {
5049
*/
5150
const project = await factories.projectsFactory.findById(projectId);
5251

53-
if (project.workspaceId.toString() === DEMO_WORKSPACE_ID) {
52+
if (project.workspaceId.toString() === '6213b6a01e6281087467cc7a') {
5453
return [ await factories.usersFactory.findById(user.id) ];
5554
}
5655

src/resolvers/project.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { ReceiveTypes } from '@hawk.so/types';
22
import * as telegram from '../utils/telegram';
3-
import { DEMO_WORKSPACE_ID } from '../constants/demoWorkspace';
43
const mongo = require('../mongo');
54
const { ObjectId } = require('mongodb');
65
const { ApolloError, UserInputError } = require('apollo-server-express');
@@ -254,7 +253,7 @@ module.exports = {
254253
throw new ApolloError('There is no project with that id');
255254
}
256255

257-
if (project.workspaceId.toString() === DEMO_WORKSPACE_ID) {
256+
if (project.workspaceId.toString() === '6213b6a01e6281087467cc7a') {
258257
throw new ApolloError('Unable to update demo project');
259258
}
260259

@@ -292,7 +291,7 @@ module.exports = {
292291
throw new ApolloError('There is no project with that id');
293292
}
294293

295-
if (project.workspaceId.toString() === DEMO_WORKSPACE_ID) {
294+
if (project.workspaceId.toString() === '6213b6a01e6281087467cc7a') {
296295
throw new ApolloError('Unable to update demo project');
297296
}
298297

@@ -400,7 +399,7 @@ module.exports = {
400399
throw new ApolloError('There is no project with that id');
401400
}
402401

403-
if (project.workspaceId.toString() === DEMO_WORKSPACE_ID) {
402+
if (project.workspaceId.toString() === '6213b6a01e6281087467cc7a') {
404403
throw new ApolloError('Unable to remove demo project');
405404
}
406405

@@ -459,7 +458,7 @@ module.exports = {
459458
throw new ApolloError('There is no project with that id');
460459
}
461460

462-
if (project.workspaceId.toString() === DEMO_WORKSPACE_ID) {
461+
if (project.workspaceId.toString() === '6213b6a01e6281087467cc7a') {
463462
throw new ApolloError('Unable to update demo project');
464463
}
465464

@@ -510,7 +509,7 @@ module.exports = {
510509
throw new ApolloError('There is no project with that id');
511510
}
512511

513-
if (project.workspaceId.toString() === DEMO_WORKSPACE_ID) {
512+
if (project.workspaceId.toString() === '6213b6a01e6281087467cc7a') {
514513
throw new ApolloError('Unable to update demo project');
515514
}
516515

src/resolvers/workspace.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Validator from '../utils/validator';
1010
import { dateFromObjectId } from '../utils/dates';
1111
import cloudPaymentsApi from '../utils/cloudPaymentsApi';
1212
import { publish } from '../rabbitmq';
13-
import { DEMO_WORKSPACE_ID } from '../constants/demoWorkspace';
1413

1514
const { ApolloError, UserInputError, ForbiddenError } = require('apollo-server-express');
1615
const crypto = require('crypto');
@@ -552,7 +551,7 @@ module.exports = {
552551
/**
553552
* Crutch for Demo Workspace
554553
*/
555-
if (workspaceData._id.toString() === DEMO_WORKSPACE_ID) {
554+
if (workspaceData._id.toString() === '6213b6a01e6281087467cc7a') {
556555
return [
557556
{
558557
_id: user.id,

test/integrations/github-routes.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ObjectId } from 'mongodb';
33
import express from 'express';
44
import { createGitHubRouter } from '../../src/integrations/github/routes';
55
import { ContextFactories } from '../../src/types/graphql';
6-
import { DEMO_WORKSPACE_ID } from '../../src/constants/demoWorkspace';
76

87
/**
98
* Mock GitHubService
@@ -33,6 +32,8 @@ jest.mock('../../src/integrations/github/store/install-state.redis.store', () =>
3332
})),
3433
}));
3534

35+
const DEMO_WORKSPACE_ID = '6213b6a01e6281087467cc7a';
36+
3637
function createMockProject(options: {
3738
projectId?: string;
3839
workspaceId?: string;

test/resolvers/project.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ObjectId } from 'mongodb';
33
import { ProjectDBScheme, ProjectTaskManagerConfig } from '@hawk.so/types';
44
import { ResolverContextWithUser } from '../../src/types/graphql';
55
import { ApolloError, UserInputError } from 'apollo-server-express';
6-
import { DEMO_WORKSPACE_ID } from '../../src/constants/demoWorkspace';
76

87
jest.mock('../../src/integrations/github/service', () => require('../__mocks__/github-service'));
98
// eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -30,6 +29,11 @@ process.env.JWT_SECRET_ACCESS_TOKEN = 'belarus';
3029
process.env.JWT_SECRET_REFRESH_TOKEN = 'abacaba';
3130
process.env.JWT_SECRET_PROJECT_TOKEN = 'qwerty';
3231

32+
/**
33+
* Demo workspace ID (projects in this workspace cannot be updated)
34+
*/
35+
const DEMO_WORKSPACE_ID = '6213b6a01e6281087467cc7a';
36+
3337
/**
3438
* Creates mock project with optional taskManager configuration
3539
*/

0 commit comments

Comments
 (0)