-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a40db58
commit 94fbc9c
Showing
5 changed files
with
70 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './lib/tasks.service'; | ||
export * from './lib/user-tasks.service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,10 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { Task, UserTask } from '@tasks/domain'; | ||
import { Task } from '@tasks/domain'; | ||
|
||
@Injectable() | ||
export class TasksService { | ||
async findAll(): Promise<Task[]> { | ||
// TODO: Implement this | ||
return []; | ||
} | ||
|
||
async findUserTasks( | ||
userId: string, | ||
range?: { from: Date; to: Date }, | ||
): Promise<UserTask[]> { | ||
// TODO: Implement this | ||
return []; | ||
} | ||
|
||
async createUserTasks( | ||
userId: string, | ||
tasks: { id: string; createdAt: Date }[], | ||
): Promise<string> { | ||
// TODO: Implement this | ||
return 'success'; | ||
} | ||
|
||
async updateUserTasks( | ||
userId: string, | ||
userTasks: { id: string; updatedAt: Date }[], | ||
): Promise<string> { | ||
// TODO: Implement this | ||
return 'success'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { UserTasksService } from './user-tasks.service'; | ||
|
||
describe('UserTasksService', () => { | ||
let service: UserTasksService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [UserTasksService], | ||
}).compile(); | ||
|
||
service = module.get<UserTasksService>(UserTasksService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
|
||
describe('findMany', () => { | ||
it('should return user tasks', async () => { | ||
const result = await service.findMany('userId', { from: new Date(), to: new Date() }); | ||
expect(result).toEqual([]); | ||
}); | ||
}); | ||
|
||
describe('createSome', () => { | ||
it('should create user tasks', async () => { | ||
const result = await service.createSome('userId', [{ id: '1', createdAt: new Date() }]); | ||
expect(result).toEqual('success'); | ||
}); | ||
}); | ||
|
||
describe('updateSome', () => { | ||
it('should update user tasks', async () => { | ||
const result = await service.updateSome('userId', [{ id: '1', updatedAt: new Date() }]); | ||
expect(result).toEqual('success'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { UserTask } from '@tasks/domain'; | ||
|
||
@Injectable() | ||
export class UserTasksService { | ||
async findMany( | ||
userId: string, | ||
range?: { from: Date; to: Date }, | ||
): Promise<UserTask[]> { | ||
// TODO: Implement this | ||
return []; | ||
} | ||
|
||
async createSome( | ||
userId: string, | ||
tasks: { id: string; createdAt: Date }[], | ||
): Promise<string> { | ||
// TODO: Implement this | ||
return 'success'; | ||
} | ||
|
||
async updateSome( | ||
userId: string, | ||
userTasks: { id: string; updatedAt: Date }[], | ||
): Promise<string> { | ||
// TODO: Implement this | ||
return 'success'; | ||
} | ||
} |