feat:移植工程
This commit is contained in:
81
src/apis/food.ts
Normal file
81
src/apis/food.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { cloudService } from './index'
|
||||
import { IFoodQuery, IFoodRecipe, IFoodRecord, IFoodStats } from '@/types/food'
|
||||
|
||||
export const addFoodRecipeApi = (foodRecipe: IFoodRecipe): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-service/food/recipe',
|
||||
method: 'post',
|
||||
data: foodRecipe
|
||||
})
|
||||
|
||||
export const updateFoodRecipeApi = (id: number, foodRecipe: IFoodRecipe): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-service/food/recipe/${id}`,
|
||||
method: 'put',
|
||||
data: foodRecipe
|
||||
})
|
||||
|
||||
export const deleteFoodRecipeApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-service/food/recipe/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryFoodRecipeByIdApi = (id: number): Promise<any> =>
|
||||
cloudService({
|
||||
url: `/home-service/food/recipe/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryFoodRecipeApi = (currentPage: number, pageSize: number,
|
||||
query: IFoodQuery): Promise<any> =>
|
||||
cloudService({
|
||||
url: '/home-service/food/recipe/page',
|
||||
method: 'get',
|
||||
params: { currentPage, pageSize, ...query }
|
||||
})
|
||||
|
||||
export const queryFoodNameListApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-service/food/recipe/name',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const addFoodRecordApi = (foodRecord: IFoodRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-service/food/record',
|
||||
method: 'post',
|
||||
data: foodRecord
|
||||
})
|
||||
|
||||
export const updateFoodRecordApi = (id: number, foodRecord: IFoodRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-service/food/record/${id}`,
|
||||
method: 'put',
|
||||
data: foodRecord
|
||||
})
|
||||
|
||||
export const deleteFoodRecordApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-service/food/record/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryFoodRecordApi = (startDate: string, endDate: string): Promise<IFoodRecord[]> =>
|
||||
cloudService({
|
||||
url: '/home-service/food/record',
|
||||
method: 'get',
|
||||
params: { startDate, endDate }
|
||||
})
|
||||
|
||||
export const queryFoodCategoryApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-service/food/category',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryFoodStatsApi = (): Promise<IFoodStats> =>
|
||||
cloudService({
|
||||
url: '/home-service/food/stats',
|
||||
method: 'get'
|
||||
})
|
||||
Reference in New Issue
Block a user