All files / app/src/entities/property/model requests.ts

60% Statements 9/15
100% Branches 1/1
33.33% Functions 1/3
60% Lines 9/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x                 1x   1x 1x 1x   1x         1x         1x 1x  
import {
  PROPERTY_VALUES_SINGLE_REQUEST_TARGET,
  PROPERTIES_REQUEST_TARGET,
  Property,
  PROPERTIES_SINGLE_REQUEST_TARGET,
} from '@/entities/property'
import { CollectionResponse } from '@/shared/@types'
import { getSingleRequestTarget, queryFetchFactory } from '@/shared/lib'
 
export const queryFetchPropertiesCollection = queryFetchFactory<CollectionResponse<Property>>(PROPERTIES_REQUEST_TARGET)
 
export const queryCreateProperty = queryFetchFactory<Omit<Property, 'unit'>>(PROPERTIES_REQUEST_TARGET, {
  method: 'POST',
})
 
export const queryDeletePropertyValue = (id: string) =>
  queryFetchFactory<Property>(getSingleRequestTarget(id, PROPERTY_VALUES_SINGLE_REQUEST_TARGET), {
    method: 'DELETE',
  })
 
export const queryUpdatePropertyValue = (id: string) =>
  queryFetchFactory<Property>(getSingleRequestTarget(id, PROPERTY_VALUES_SINGLE_REQUEST_TARGET), {
    method: 'PATCH',
  })
 
export const queryFetchPropertyById = (id: string) =>
  queryFetchFactory<Property>(getSingleRequestTarget(id, PROPERTIES_SINGLE_REQUEST_TARGET))