mirror of
https://github.com/standardnotes/server
synced 2026-08-04 00:15:57 -04:00
* 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
25 lines
703 B
TypeScript
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,
|
|
}
|
|
}
|
|
}
|