Files
standardnotes-server/packages/syncing-server/src/Domain/UseCase/GetItem/GetItem.ts
T
Karol SójkoandGitHub 993d31167b feat(syncing-server): refactor container config into server and worker (#443)
* feat(syncing-server): refactor container config into server and worker

* fix(syncing-server): yarn lock

* fix(api-gateway): add client update response on v1 revision endpoints

* fix(syncing-server): linter issue
2023-02-13 10:12:32 +01:00

25 lines
703 B
TypeScript

import { ItemRepositoryInterface } from '../../Item/ItemRepositoryInterface'
import { UseCaseInterface } from '../UseCaseInterface'
import { GetItemDTO } from './GetItemDTO'
import { GetItemResponse } from './GetItemResponse'
export class GetItem implements UseCaseInterface {
constructor(private itemRepository: ItemRepositoryInterface) {}
async execute(dto: GetItemDTO): Promise<GetItemResponse> {
const item = await this.itemRepository.findByUuidAndUserUuid(dto.itemUuid, dto.userUuid)
if (item === null) {
return {
success: false,
message: `Could not find item with uuid ${dto.itemUuid}`,
}
}
return {
success: true,
item,
}
}
}