Skip to content

Commit 7fc7fe3

Browse files
nicknisidoug-martin
authored andcommitted
example: remove tags, subtasks from custom-service
1 parent c11b2d4 commit 7fc7fe3

17 files changed

+14
-1941
lines changed
Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,23 @@
11
import { Connection } from 'typeorm';
2-
import { SubTaskEntity } from '../src/sub-task/sub-task.entity';
3-
import { TagEntity } from '../src/tag/tag.entity';
4-
import { TodoItemEntity } from '../src/todo-item/todo-item.entity';
52
import { executeTruncate } from '../../helpers';
3+
import { TodoItemEntity } from '../src/todo-item/todo-item.entity';
64

7-
const tables = ['todo_item', 'sub_task', 'tag'];
5+
const tables = ['todo_item'];
86
export const truncate = async (connection: Connection): Promise<void> => executeTruncate(connection, tables);
97

108
export const refresh = async (connection: Connection): Promise<void> => {
119
await truncate(connection);
1210

1311
const todoRepo = connection.getRepository(TodoItemEntity);
14-
const subTaskRepo = connection.getRepository(SubTaskEntity);
15-
const tagsRepo = connection.getRepository(TagEntity);
1612

17-
const urgentTag = await tagsRepo.save({ name: 'Urgent' });
18-
const homeTag = await tagsRepo.save({ name: 'Home' });
19-
const workTag = await tagsRepo.save({ name: 'Work' });
20-
const questionTag = await tagsRepo.save({ name: 'Question' });
21-
const blockedTag = await tagsRepo.save({ name: 'Blocked' });
22-
23-
const todoItems = await todoRepo.save([
24-
{ title: 'Create Nest App', completed: true, tags: [urgentTag, homeTag] },
25-
{ title: 'Create Entity', completed: false, tags: [urgentTag, workTag] },
26-
{ title: 'Create Entity Service', completed: false, tags: [blockedTag, workTag] },
27-
{ title: 'Add Todo Item Resolver', completed: false, tags: [blockedTag, homeTag] },
13+
await todoRepo.save([
14+
{ title: 'Create Nest App', completed: true },
15+
{ title: 'Create Entity', completed: false },
16+
{ title: 'Create Entity Service', completed: false },
17+
{ title: 'Add Todo Item Resolver', completed: false },
2818
{
2919
title: 'How to create item With Sub Tasks',
3020
completed: false,
31-
tags: [questionTag, blockedTag],
3221
},
3322
]);
34-
35-
await subTaskRepo.save(
36-
todoItems.reduce((subTasks, todo) => {
37-
return [
38-
...subTasks,
39-
{ completed: true, title: `${todo.title} - Sub Task 1`, todoItem: todo },
40-
{ completed: false, title: `${todo.title} - Sub Task 2`, todoItem: todo },
41-
{ completed: false, title: `${todo.title} - Sub Task 3`, todoItem: todo },
42-
];
43-
}, [] as Partial<SubTaskEntity>[]),
44-
);
4523
};

examples/custom-service/e2e/graphql-fragments.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@ export const todoItemFields = `
55
description
66
`;
77

8-
export const subTaskFields = `
9-
id
10-
title
11-
description
12-
completed
13-
todoItemId
14-
`;
15-
16-
export const tagFields = `
17-
id
18-
name
19-
`;
20-
218
export const pageInfoField = `
229
pageInfo{
2310
hasNextPage

0 commit comments

Comments
 (0)