Restructure
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
import ky from 'ky'
|
||||
import type { Language } from '../../data/language'
|
||||
|
||||
export const getLanguages = async (): Promise<Language[]> => {
|
||||
return ky.get(`http://localhost:8088/languages`).json<Language[]>()
|
||||
}
|
||||
|
||||
export const getLanguageById = async (id: number): Promise<Language> => {
|
||||
return ky.get(`http://localhost:8088/language/${id}`).json<Language>()
|
||||
}
|
||||
|
||||
export const createLanguage = async (language: Language): Promise<Language> => {
|
||||
return ky.post(`http://localhost:8088/language`, { json: language }).json<Language>()
|
||||
}
|
||||
|
||||
export const updateLanguage = async (language: Language): Promise<void> => {
|
||||
await ky.put(`http://localhost:8088/language`, { json: language })
|
||||
}
|
||||
|
||||
export const deleteLanguage = async (id: number): Promise<void> => {
|
||||
await ky.delete(`http://localhost:8088/language/${id}`)
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import ky from 'ky'
|
||||
import type { ProductGroup } from '../../data/productGroup'
|
||||
|
||||
export const getProductGroups = async (): Promise<ProductGroup[]> => {
|
||||
return ky.get(`http://localhost:8088/productgroups`).json<ProductGroup[]>()
|
||||
}
|
||||
|
||||
export const getProductGroupById = async (id: number): Promise<ProductGroup> => {
|
||||
return ky.get(`http://localhost:8088/productgroup/${id}`).json<ProductGroup>()
|
||||
}
|
||||
|
||||
export const createProductGroup = async (productGroup: ProductGroup): Promise<ProductGroup> => {
|
||||
return ky.post(`http://localhost:8088/productgroup`, { json: productGroup }).json<ProductGroup>()
|
||||
}
|
||||
|
||||
export const updateProductGroup = async (productGroup: ProductGroup): Promise<void> => {
|
||||
await ky.put(`http://localhost:8088/productgroup`, { json: productGroup })
|
||||
}
|
||||
|
||||
export const deleteProductGroup = async (id: number): Promise<void> => {
|
||||
await ky.delete(`http://localhost:8088/productgroup/${id}`)
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import ky from 'ky'
|
||||
import type { Product } from '../../data/product'
|
||||
|
||||
export const getProducts = async (): Promise<Product[]> => {
|
||||
return ky.get(`http://localhost:8088/products`).json<Product[]>()
|
||||
}
|
||||
|
||||
export const getProductById = async (id: number): Promise<Product> => {
|
||||
return ky.get(`http://localhost:8088/product/${id}`).json<Product>()
|
||||
}
|
||||
|
||||
export const createProduct = async (id: string): Promise<Product> => {
|
||||
return ky.post(`http://localhost:8088/product`, { json: { id } }).json<Product>()
|
||||
}
|
||||
|
||||
export const updateProduct = async (product: Product): Promise<void> => {
|
||||
await ky.put(`http://localhost:8088/product`, { json: product })
|
||||
}
|
||||
|
||||
export const deleteProduct = async (id: number): Promise<void> => {
|
||||
await ky.delete(`http://localhost:8088/product/${id}`)
|
||||
}
|
||||
|
||||
export const getProductsByProductGroupId = async (productGroupId: number): Promise<Product[]> => {
|
||||
return ky.get(`http://localhost:8088/products/productGroup/${productGroupId}`).json<Product[]>()
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import ky from 'ky'
|
||||
import type { PropertyGroup } from '../../data/propertyGroup'
|
||||
|
||||
export const getPropertyGroups = async (): Promise<PropertyGroup[]> => {
|
||||
return ky.get(`http://localhost:8088/propertygroups`).json<PropertyGroup[]>()
|
||||
}
|
||||
|
||||
export const getPropertyGroupById = async (id: number): Promise<PropertyGroup> => {
|
||||
return ky.get(`http://localhost:8088/propertygroup/${id}`).json<PropertyGroup>()
|
||||
}
|
||||
|
||||
export const createPropertyGroup = async (propertyGroup: PropertyGroup): Promise<PropertyGroup> => {
|
||||
return ky.post(`http://localhost:8088/propertygroup`, { json: propertyGroup }).json<PropertyGroup>()
|
||||
}
|
||||
|
||||
export const updatePropertyGroup = async (propertyGroup: PropertyGroup): Promise<void> => {
|
||||
await ky.put(`http://localhost:8088/propertygroup`, { json: propertyGroup })
|
||||
}
|
||||
|
||||
export const deletePropertyGroup = async (id: number): Promise<void> => {
|
||||
await ky.delete(`http://localhost:8088/propertygroup/${id}`)
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
import ky from 'ky'
|
||||
import type { PropertyType } from '../../data/propertyType'
|
||||
|
||||
export const getPropertyTypes = async (): Promise<PropertyType[]> => {
|
||||
return ky.get(`http://localhost:8088/propertytypes`).json<PropertyType[]>()
|
||||
}
|
||||
|
||||
export const getPropertyTypeById = async (id: number): Promise<PropertyType> => {
|
||||
return ky.get(`http://localhost:8088/propertytype/${id}`).json<PropertyType>()
|
||||
}
|
||||
|
||||
export const createPropertyType = async (propertyType: PropertyType): Promise<PropertyType> => {
|
||||
return ky.post(`http://localhost:8088/propertytype`, { json: propertyType }).json<PropertyType>()
|
||||
}
|
||||
|
||||
export const updatePropertyType = async (propertyType: PropertyType): Promise<void> => {
|
||||
await ky.put(`http://localhost:8088/propertytype`, { json: propertyType })
|
||||
}
|
||||
|
||||
export const deletePropertyType = async (id: number): Promise<void> => {
|
||||
await ky.delete(`http://localhost:8088/propertytype/${id}`)
|
||||
}
|
||||
|
||||
export const getPropertyTypesByPropertyGroupId = async (propertyGroupId: number): Promise<PropertyType[]> => {
|
||||
return ky.get(`http://localhost:8088/propertytypes/${propertyGroupId}`).json<PropertyType[]>()
|
||||
}
|
||||
|
||||
export const getAllPropertyTypes = async (): Promise<PropertyType[]> => {
|
||||
return ky.get(`http://localhost:8088/propertytypes`).json<PropertyType[]>()
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import ky from 'ky'
|
||||
import type { Translation } from '../../data/translation'
|
||||
|
||||
export const getTranslations = async (): Promise<Translation[]> => {
|
||||
return ky.get(`http://localhost:8088/translations`).json<Translation[]>()
|
||||
}
|
||||
|
||||
export const getTranslationById = async (id: number): Promise<Translation> => {
|
||||
return ky.get(`http://localhost:8088/translation/${id}`).json<Translation>()
|
||||
}
|
||||
|
||||
export const createTranslation = async (translation: Translation): Promise<Translation> => {
|
||||
return ky.post(`http://localhost:8088/translation`, { json: translation }).json<Translation>()
|
||||
}
|
||||
|
||||
export const updateTranslation = async (translation: Translation): Promise<void> => {
|
||||
await ky.put(`http://localhost:8088/translation`, { json: translation })
|
||||
}
|
||||
|
||||
export const deleteTranslation = async (id: number): Promise<void> => {
|
||||
await ky.delete(`http://localhost:8088/translation/${id}`)
|
||||
}
|
||||
|
||||
export const getTranslationsByLanguageId = async (language_id: number): Promise<Translation[]> => {
|
||||
return ky.get(`http://localhost:8088/translations/${language_id}`).json<Translation[]>()
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import ky from 'ky'
|
||||
import type { ValueComplexity } from '../../data/valueComplexity'
|
||||
|
||||
export const getValueComplexities = async (): Promise<ValueComplexity[]> => {
|
||||
return ky.get(`http://localhost:8088/valuecomplexities`).json<ValueComplexity[]>()
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import ky from 'ky'
|
||||
import type { ValueType } from '../../data/valueType'
|
||||
|
||||
export const getValueTypes = async (): Promise<ValueType[]> => {
|
||||
return ky.get(`http://localhost:8088/valuetypes`).json<ValueType[]>()
|
||||
}
|
||||
|
||||
export const getValueTypeById = async (id: number): Promise<ValueType> => {
|
||||
return ky.get(`http://localhost:8088/valuetype/${id}`).json<ValueType>()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user