Initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { MockupMatchProvider } from '../provider/MockupMatchProvider'
|
||||
import type { MatchFilters } from '../provider/IMatchProvider'
|
||||
import type { Match } from '../domain/match'
|
||||
import type { ListResponse, ItemResponse } from './types'
|
||||
|
||||
const provider = MockupMatchProvider
|
||||
|
||||
export const matchService = {
|
||||
async getAll(filters?: MatchFilters): Promise<ListResponse<Match>> {
|
||||
const data = await provider.getAll(filters)
|
||||
return { data, meta: { total: data.length, page: 1, pageSize: data.length, hasMore: false } }
|
||||
},
|
||||
async getById(id: string): Promise<ItemResponse<Match | null>> {
|
||||
const data = await provider.getById(id)
|
||||
return { data }
|
||||
},
|
||||
async getByNeed(needId: string): Promise<ListResponse<Match>> {
|
||||
const data = await provider.getByNeed(needId)
|
||||
return { data, meta: { total: data.length, page: 1, pageSize: data.length, hasMore: false } }
|
||||
},
|
||||
async getByProperty(propertyId: string): Promise<ListResponse<Match>> {
|
||||
const data = await provider.getByProperty(propertyId)
|
||||
return { data, meta: { total: data.length, page: 1, pageSize: data.length, hasMore: false } }
|
||||
},
|
||||
async approve(id: string, reviewedBy: string): Promise<ItemResponse<Match>> {
|
||||
const data = await provider.approve(id, reviewedBy)
|
||||
return { data }
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user