Skip to content

Commit 1e78a1f

Browse files
committed
chore(): lint fix
1 parent 00fa9df commit 1e78a1f

File tree

2 files changed

+45
-41
lines changed

2 files changed

+45
-41
lines changed

src/models/project.ts

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ interface UpdateProjectNotificationsRulePayload {
113113
* Payload for creating new project pattern
114114
*/
115115
type CreateProjectPatternPayload = {
116-
pattern: string,
116+
pattern: string;
117117
};
118118

119119
/**
@@ -124,19 +124,19 @@ type UpdateProjectPatternPayload = {
124124
/**
125125
* Id of the pattern to be updated
126126
*/
127-
id: string,
127+
id: string;
128128

129129
/**
130130
* New pattern string
131131
*/
132-
pattern: string,
132+
pattern: string;
133133
};
134134

135135
type RemoveProjectPatternPayload = {
136136
/**
137137
* Id of the pattern to be removed
138138
*/
139-
id: string,
139+
id: string;
140140
}
141141

142142
/**
@@ -276,18 +276,18 @@ export default class ProjectModel extends AbstractModel<ProjectDBScheme> impleme
276276
const pattern: ProjectEventGroupingPatternsDBScheme = {
277277
_id: new ObjectId(),
278278
pattern: payload.pattern,
279-
}
279+
};
280280

281281
await this.collection.updateOne({
282282
_id: this._id,
283283
},
284284
{
285-
$push: {
285+
$push: {
286286
eventGroupingPatterns: {
287287
$each: [ pattern ],
288288
$position: 0,
289-
}
290-
}
289+
},
290+
},
291291
});
292292

293293
return pattern;
@@ -301,16 +301,17 @@ export default class ProjectModel extends AbstractModel<ProjectDBScheme> impleme
301301
public async updateProjectEventGroupingPattern(payload: UpdateProjectPatternPayload): Promise<ProjectEventGroupingPatternsDBScheme> {
302302
const udpatedPattern = {
303303
_id: new ObjectId(payload.id),
304-
pattern: payload.pattern
305-
}
306-
304+
pattern: payload.pattern,
305+
};
306+
307307
await this.collection.updateOne({
308-
_id: this._id, "eventGroupingPatterns._id": new ObjectId(udpatedPattern._id)
308+
_id: this._id,
309+
'eventGroupingPatterns._id': new ObjectId(udpatedPattern._id),
309310
},
310-
{
311-
$set: { "eventGroupingPatterns.$.pattern": udpatedPattern.pattern }
311+
{
312+
$set: { 'eventGroupingPatterns.$.pattern': udpatedPattern.pattern },
312313
});
313-
314+
314315
return udpatedPattern;
315316
}
316317

@@ -340,26 +341,29 @@ export default class ProjectModel extends AbstractModel<ProjectDBScheme> impleme
340341
});
341342

342343
if (!project) {
343-
throw new Error ('Project with such id does not exist');
344+
throw new Error('Project with such id does not exist');
344345
}
345346

346347
const patternList = await this.collection.findOne(
347-
{ _id: this._id, "eventGroupingPatterns._id": new ObjectId(payload.id) },
348-
{ projection: { "eventGroupingPatterns.$": 1 } }
348+
{
349+
_id: this._id,
350+
'eventGroupingPatterns._id': new ObjectId(payload.id),
351+
},
352+
{ projection: { 'eventGroupingPatterns.$': 1 } }
349353
);
350-
354+
351355
const deletedPattern = patternList?.eventGroupingPatterns[0];
352356

353357
if (deletedPattern === undefined) {
354-
throw new Error ('Pattern with such id does not exist')
358+
throw new Error('Pattern with such id does not exist');
355359
}
356360

357361
await this.collection.updateOne(
358362
{
359-
_id: new ObjectId(this._id)
363+
_id: new ObjectId(this._id),
360364
},
361-
{
362-
$pull: { eventGroupingPatterns: { _id: new ObjectId(payload.id) } }
365+
{
366+
$pull: { eventGroupingPatterns: { _id: new ObjectId(payload.id) } },
363367
}
364368
);
365369

src/resolvers/projectPatterns.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ResolverContextWithUser } from "../types/graphql";
1+
import { ResolverContextWithUser } from '../types/graphql';
22
import { ApolloError } from 'apollo-server-express';
3-
import { ProjectEventGroupingPatternsDBScheme } from "@hawk.so/types";
3+
import { ProjectEventGroupingPatternsDBScheme } from '@hawk.so/types';
44

55
/**
66
* Type that represents payload for create project pattern mutation
@@ -24,26 +24,26 @@ interface UpdateProjectPatternMutationPayload {
2424
/**
2525
* Id of the pattern to be updated
2626
*/
27-
id: string,
27+
id: string;
2828

2929
/**
3030
* ProjectId of the pattern to be updated
3131
*/
32-
projectId: string,
32+
projectId: string;
3333

3434
/**
3535
* New pattern
3636
*/
37-
pattern: string,
37+
pattern: string;
3838
};
3939

4040
/**
4141
* Type that represents payload for remove project pattern mutation
4242
*/
4343
interface RemoveProjectPatternMutationPayload {
44-
id: string,
44+
id: string;
4545

46-
projectId: string,
46+
projectId: string;
4747
}
4848

4949
export default {
@@ -70,9 +70,9 @@ export default {
7070

7171
existingPatterns.forEach(pattern => {
7272
if (pattern.pattern.match(new RegExp(input.pattern)) || input.pattern.match(new RegExp(pattern.pattern))) {
73-
throw new ApolloError('New pattern collides with existing one')
74-
}
75-
})
73+
throw new ApolloError('New pattern collides with existing one');
74+
}
75+
});
7676

7777
return await project.createProjectEventGroupingPattern({ pattern: input.pattern });
7878
},
@@ -87,7 +87,7 @@ export default {
8787
async updateProjectEventGroupingPattern(
8888
_obj: undefined,
8989
{ input }: { input: UpdateProjectPatternMutationPayload },
90-
{ user, factories }: ResolverContextWithUser
90+
{ user, factories }: ResolverContextWithUser
9191
): Promise<ProjectEventGroupingPatternsDBScheme> {
9292
const project = await factories.projectsFactory.findById(input.projectId);
9393

@@ -100,8 +100,8 @@ export default {
100100
existingPatterns.forEach(pattern => {
101101
if (pattern._id.toString() !== input.id) {
102102
if (pattern.pattern.match(new RegExp(input.pattern)) || input.pattern.match(new RegExp(pattern.pattern))) {
103-
throw new ApolloError('New pattern collides with existing one')
104-
}
103+
throw new ApolloError('New pattern collides with existing one');
104+
}
105105
}
106106
});
107107

@@ -114,11 +114,11 @@ export default {
114114
* @param user - current authorized user {@see ../index.js}
115115
* @param factories - factories for working with models
116116
* @param input - input data for creating
117-
*/
117+
*/
118118
async removeProjectEventGroupingPattern(
119119
obj: undefined,
120120
{ input }: { input: RemoveProjectPatternMutationPayload },
121-
{ user, factories }: ResolverContextWithUser
121+
{ user, factories }: ResolverContextWithUser
122122
): Promise<ProjectEventGroupingPatternsDBScheme> {
123123
const project = await factories.projectsFactory.findById(input.projectId);
124124

@@ -127,6 +127,6 @@ export default {
127127
}
128128

129129
return await project.removeProjectEventGroupingPattern({ id: input.id });
130-
}
131-
}
132-
}
130+
},
131+
},
132+
};

0 commit comments

Comments
 (0)