37 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			37 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
|  | import apiClient from '../apiClient'; | ||
|  | import type { PorcMonCanillaDto } from '../../models/dtos/Distribucion/PorcMonCanillaDto'; | ||
|  | import type { CreatePorcMonCanillaDto } from '../../models/dtos/Distribucion/CreatePorcMonCanillaDto'; | ||
|  | import type { UpdatePorcMonCanillaDto } from '../../models/dtos/Distribucion/UpdatePorcMonCanillaDto'; | ||
|  | 
 | ||
|  | const getPorcMonCanillaPorPublicacion = async (idPublicacion: number): Promise<PorcMonCanillaDto[]> => { | ||
|  |     const response = await apiClient.get<PorcMonCanillaDto[]>(`/publicaciones/${idPublicacion}/porcentajesmoncanilla`); | ||
|  |     return response.data; | ||
|  | }; | ||
|  | 
 | ||
|  | const getPorcMonCanillaById = async (idPublicacion: number, idPorcMon: number): Promise<PorcMonCanillaDto> => { | ||
|  |     const response = await apiClient.get<PorcMonCanillaDto>(`/publicaciones/${idPublicacion}/porcentajesmoncanilla/${idPorcMon}`); | ||
|  |     return response.data; | ||
|  | }; | ||
|  | 
 | ||
|  | const createPorcMonCanilla = async (idPublicacion: number, data: CreatePorcMonCanillaDto): Promise<PorcMonCanillaDto> => { | ||
|  |     const response = await apiClient.post<PorcMonCanillaDto>(`/publicaciones/${idPublicacion}/porcentajesmoncanilla`, data); | ||
|  |     return response.data; | ||
|  | }; | ||
|  | 
 | ||
|  | const updatePorcMonCanilla = async (idPublicacion: number, idPorcMon: number, data: UpdatePorcMonCanillaDto): Promise<void> => { | ||
|  |     await apiClient.put(`/publicaciones/${idPublicacion}/porcentajesmoncanilla/${idPorcMon}`, data); | ||
|  | }; | ||
|  | 
 | ||
|  | const deletePorcMonCanilla = async (idPublicacion: number, idPorcMon: number): Promise<void> => { | ||
|  |     await apiClient.delete(`/publicaciones/${idPublicacion}/porcentajesmoncanilla/${idPorcMon}`); | ||
|  | }; | ||
|  | 
 | ||
|  | const porcMonCanillaService = { | ||
|  |     getPorcMonCanillaPorPublicacion, | ||
|  |     getPorcMonCanillaById, | ||
|  |     createPorcMonCanilla, | ||
|  |     updatePorcMonCanilla, | ||
|  |     deletePorcMonCanilla, | ||
|  | }; | ||
|  | 
 | ||
|  | export default porcMonCanillaService; |