Skip to content

Commit

Permalink
Generating endpoints for the 10 base crud endpoints in all concrete c…
Browse files Browse the repository at this point in the history
…lasses.
  • Loading branch information
buchananwill committed Apr 10, 2024
1 parent 4bebfa7 commit 76f0841
Show file tree
Hide file tree
Showing 16 changed files with 344 additions and 30 deletions.
8 changes: 7 additions & 1 deletion app/api/READ-ONLY-generated-actions/Carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ export const {
getPage,
deleteIdList,
postList,
putList
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
CarouselDto,
string
Expand Down
23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/CarouselGroup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { CarouselGroupDto } from '../dtos/CarouselGroupDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
CarouselGroupDto,
string
>(
'/api/v2/carouselGroups'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/CarouselGroupOption.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { CarouselGroupOptionDto } from '../dtos/CarouselGroupOptionDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
CarouselGroupOptionDto,
number
>(
'/api/v2/carouselGroups/options'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/CarouselOption.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { CarouselOptionDto } from '../dtos/CarouselOptionDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
CarouselOptionDto,
number
>(
'/api/v2/carouselGroups/carousels/options'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/CarouselOrder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { CarouselOrderDto } from '../dtos/CarouselOrderDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
CarouselOrderDto,
string
>(
'/api/v2/carouselGroups/orders'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/CarouselOrderItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { CarouselOrderItemDto } from '../dtos/CarouselOrderItemDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
CarouselOrderItemDto,
number
>(
'/api/v2/carousels/orders/items'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/Organization.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { Long } from '../dtos/LongSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
Long,
number
>(
'/api/v2/workProjectSeriesSchemas/bundleAssignments'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/WorkProjectSeriesSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { WorkProjectSeriesSchemaDto } from '../dtos/WorkProjectSeriesSchemaDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
WorkProjectSeriesSchemaDto,
string
>(
'/api/v2/workProjectSeriesSchemas'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/WorkSeriesBundleAssignment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { WorkSeriesBundleAssignmentDto } from '../dtos/WorkSeriesBundleAssignmentDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
WorkSeriesBundleAssignmentDto,
number
>(
'/api/v2/workProjectSeriesSchemas/bundleAssignments'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/WorkSeriesSchemaBundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { WorkSeriesSchemaBundleLeanDto } from '../dtos/WorkSeriesSchemaBundleLeanDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
WorkSeriesSchemaBundleLeanDto,
number
>(
'/api/v2/workProjectSeriesSchemas/bundles'
);


23 changes: 23 additions & 0 deletions app/api/READ-ONLY-generated-actions/WorkTaskType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use server';
import { generateBaseEndpointSet } from '../actions/template-endpoints';
import { WorkTaskTypeDto } from '../dtos/WorkTaskTypeDtoSchema';

export const {
getPage,
deleteIdList,
postList,
putList,
getOne,
postOne,
putOne,
deleteOne,
getDtoListByBodyList,
getDtoListByParamList
} = generateBaseEndpointSet<
WorkTaskTypeDto,
number
>(
'/api/v2/workTaskTypes'
);


15 changes: 15 additions & 0 deletions app/api/actions/template-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ export async function patchEntity<T>(
});
return callApi<T>(url, requestInit);
}
export async function putEntity<T>(
entity: T,
url: string
): ActionResponsePromise<T> {
const requestInit = createRequestInit({
body: entity,
method: 'PUT'
});
return callApi<T>(url, requestInit);
}
export async function patchEntityList<T>(
entityList: T[],
url: string
Expand Down Expand Up @@ -137,6 +147,11 @@ export async function deleteEntities<T>(
return callApi<T[]>(url, request);
}

export async function deleteEntity<T>(url: string): ActionResponsePromise<T> {
const request = createRequestInit({ method: 'DELETE' });
return callApi<T>(url, request);
}

async function callApi<T>(
url: string,
request: RequestInit
Expand Down
Loading

0 comments on commit 76f0841

Please sign in to comment.