@ -14,7 +14,7 @@ type ApiResult<T> =
| { success : true ; data : T }
| { success : true ; data : T }
| { success : false ; error : SlotDefinitionError } ;
| { success : false ; error : SlotDefinitionError } ;
// GET /admin/ club s/{club_id}/slot-definitions
// GET /admin/ facilitie s/{club_id}/slot-definitions
export async function getSlotDefinitions (
export async function getSlotDefinitions (
clubId : number ,
clubId : number ,
filters ? : { court_id? : number ; active_on? : string }
filters ? : { court_id? : number ; active_on? : string }
@ -25,7 +25,7 @@ export async function getSlotDefinitions(
if ( filters ? . active_on ) params . append ( 'active_on' , filters . active_on ) ;
if ( filters ? . active_on ) params . append ( 'active_on' , filters . active_on ) ;
const queryString = params . toString ( ) ;
const queryString = params . toString ( ) ;
const endpoint = ` /admin/ club s/${ clubId } /slot-definitions ${ queryString ? ` ? ${ queryString } ` : '' } ` ;
const endpoint = ` /admin/ facilitie s/${ clubId } /slot-definitions ${ queryString ? ` ? ${ queryString } ` : '' } ` ;
const response = await apiFetch ( endpoint , {
const response = await apiFetch ( endpoint , {
method : 'GET' ,
method : 'GET' ,
@ -55,13 +55,13 @@ export async function getSlotDefinitions(
}
}
}
}
// POST /admin/ club s/{club_id}/slot-definitions
// POST /admin/ facilitie s/{club_id}/slot-definitions
export async function createSlotDefinition (
export async function createSlotDefinition (
clubId : number ,
clubId : number ,
request : SlotDefinitionRequest
request : SlotDefinitionRequest
) : Promise < ApiResult < SlotDefinition > > {
) : Promise < ApiResult < SlotDefinition > > {
try {
try {
const response = await apiFetch ( ` /admin/ club s/${ clubId } /slot-definitions ` , {
const response = await apiFetch ( ` /admin/ facilitie s/${ clubId } /slot-definitions ` , {
method : 'POST' ,
method : 'POST' ,
headers : {
headers : {
'Content-Type' : 'application/json' ,
'Content-Type' : 'application/json' ,
@ -90,7 +90,7 @@ export async function createSlotDefinition(
}
}
}
}
// PATCH /admin/ club s/{club_id}/slot-definitions/{slot_definition_id}
// PATCH /admin/ facilitie s/{club_id}/slot-definitions/{slot_definition_id}
export async function updateSlotDefinition (
export async function updateSlotDefinition (
clubId : number ,
clubId : number ,
slotDefinitionId : number ,
slotDefinitionId : number ,
@ -98,7 +98,7 @@ export async function updateSlotDefinition(
) : Promise < ApiResult < SlotDefinition > > {
) : Promise < ApiResult < SlotDefinition > > {
try {
try {
const response = await apiFetch (
const response = await apiFetch (
` /admin/ club s/${ clubId } /slot-definitions/ ${ slotDefinitionId } ` ,
` /admin/ facilitie s/${ clubId } /slot-definitions/ ${ slotDefinitionId } ` ,
{
{
method : 'PATCH' ,
method : 'PATCH' ,
headers : {
headers : {
@ -129,14 +129,14 @@ export async function updateSlotDefinition(
}
}
}
}
// DELETE /admin/ club s/{club_id}/slot-definitions/{slot_definition_id}
// DELETE /admin/ facilitie s/{club_id}/slot-definitions/{slot_definition_id}
export async function deleteSlotDefinition (
export async function deleteSlotDefinition (
clubId : number ,
clubId : number ,
slotDefinitionId : number
slotDefinitionId : number
) : Promise < ApiResult < void > > {
) : Promise < ApiResult < void > > {
try {
try {
const response = await apiFetch (
const response = await apiFetch (
` /admin/ club s/${ clubId } /slot-definitions/ ${ slotDefinitionId } ` ,
` /admin/ facilitie s/${ clubId } /slot-definitions/ ${ slotDefinitionId } ` ,
{
{
method : 'DELETE' ,
method : 'DELETE' ,
}
}
@ -190,13 +190,13 @@ export async function getSlotDefinitionPresets(): Promise<ApiResult<GetPresetsRe
}
}
}
}
// POST /admin/ club s/{club_id}/slot-definitions/generate
// POST /admin/ facilitie s/{club_id}/slot-definitions/generate
export async function generateSlotDefinitions (
export async function generateSlotDefinitions (
clubId : number ,
clubId : number ,
request : GenerateSlotDefinitionsRequest
request : GenerateSlotDefinitionsRequest
) : Promise < ApiResult < GenerateSlotDefinitionsResponse > > {
) : Promise < ApiResult < GenerateSlotDefinitionsResponse > > {
try {
try {
const response = await apiFetch ( ` /admin/ club s/${ clubId } /slot-definitions/generate ` , {
const response = await apiFetch ( ` /admin/ facilitie s/${ clubId } /slot-definitions/generate ` , {
method : 'POST' ,
method : 'POST' ,
headers : {
headers : {
'Content-Type' : 'application/json' ,
'Content-Type' : 'application/json' ,
@ -225,7 +225,7 @@ export async function generateSlotDefinitions(
}
}
}
}
// POST /admin/ club s/{club_id}/slot-definitions/{slot_definition_id}/clone
// POST /admin/ facilitie s/{club_id}/slot-definitions/{slot_definition_id}/clone
export async function cloneSlotDefinition (
export async function cloneSlotDefinition (
clubId : number ,
clubId : number ,
slotDefinitionId : number ,
slotDefinitionId : number ,
@ -233,7 +233,7 @@ export async function cloneSlotDefinition(
) : Promise < ApiResult < CloneSlotDefinitionResponse > > {
) : Promise < ApiResult < CloneSlotDefinitionResponse > > {
try {
try {
const response = await apiFetch (
const response = await apiFetch (
` /admin/ club s/${ clubId } /slot-definitions/ ${ slotDefinitionId } /clone ` ,
` /admin/ facilitie s/${ clubId } /slot-definitions/ ${ slotDefinitionId } /clone ` ,
{
{
method : 'POST' ,
method : 'POST' ,
headers : {
headers : {