Skip to content

Commit

Permalink
Merge pull request #43 from jamalsoueidan/payout-paginate
Browse files Browse the repository at this point in the history
Payout paginate
  • Loading branch information
jamalsoueidan authored Apr 1, 2024
2 parents de5e6d0 + f8e8e3e commit 01c0ee3
Show file tree
Hide file tree
Showing 35 changed files with 1,586 additions and 277 deletions.
2 changes: 1 addition & 1 deletion app/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function Hero({
</Button>
</Flex>
</Stack>
<Suspense fallback={<Skeleton height={50} />}>
<Suspense fallback={<Skeleton height={500} />}>
<Await resolve={artists}>
{({payload}) => <CardStack artists={payload.results} />}
</Await>
Expand Down
117 changes: 111 additions & 6 deletions app/lib/api/bookingShopifyApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@ import type {
CustomerLocationUpdateBody,
CustomerLocationUpdateResponse,
CustomerOrderGetResponse,
CustomerPayoutAccountCreate200,
CustomerPayoutAccountCreateBody,
CustomerPayoutAccountDestroy200,
CustomerPayoutAccountGet200,
CustomerPayoutAccountCreateResponse,
CustomerPayoutAccountDestroyResponse,
CustomerPayoutAccountGetResponse,
CustomerPayoutBalanceResponse,
CustomerPayoutCreateResponse,
CustomerPayoutGetResponse,
CustomerPayoutLogPaginateParams,
CustomerPayoutLogResponse,
CustomerPayoutPaginateParams,
CustomerPayoutPaginateResponse,
CustomerProductCreateVariantBody,
CustomerProductCreateVariantResponse,
CustomerProductDestroyResponse,
Expand Down Expand Up @@ -315,6 +322,70 @@ export const getBookingShopifyApi = () => {
});
};

/**
* This endpoint get all payouts
* @summary GET get all payouts using paginate
*/
const customerPayoutPaginate = (
customerId: string,
params: CustomerPayoutPaginateParams,
) => {
return queryClient<CustomerPayoutPaginateResponse>({
url: `/customer/${customerId}/payouts/paginate`,
method: 'GET',
params,
});
};

/**
* This endpoint get payout balance
* @summary GET get payout balance
*/
const customerPayoutBalance = (customerId: string) => {
return queryClient<CustomerPayoutBalanceResponse>({
url: `/customer/${customerId}/payouts/balance`,
method: 'GET',
});
};

/**
* This endpoint get payout
* @summary GET get payout
*/
const customerPayoutGet = (customerId: string, payoutId: string) => {
return queryClient<CustomerPayoutGetResponse>({
url: `/customer/${customerId}/payout/${payoutId}`,
method: 'GET',
});
};

/**
* This endpoint create payout
* @summary POST Create payout
*/
const customerPayoutCreate = (customerId: string) => {
return queryClient<CustomerPayoutCreateResponse>({
url: `/customer/${customerId}/payout/create`,
method: 'POST',
});
};

/**
* This endpoint get all payout logs for specific payout
* @summary GET get all payout logs for specific payout using paginate
*/
const customerPayoutLogPaginate = (
customerId: string,
payoutId: string,
params: CustomerPayoutLogPaginateParams,
) => {
return queryClient<CustomerPayoutLogResponse>({
url: `/customer/${customerId}/payout-logs/${payoutId}/paginate`,
method: 'GET',
params,
});
};

/**
* This endpoint create new payout account
* @summary POST Create payout account
Expand All @@ -323,7 +394,7 @@ export const getBookingShopifyApi = () => {
customerId: string,
customerPayoutAccountCreateBody: BodyType<CustomerPayoutAccountCreateBody>,
) => {
return queryClient<CustomerPayoutAccountCreate200>({
return queryClient<CustomerPayoutAccountCreateResponse>({
url: `/customer/${customerId}/payout-account`,
method: 'POST',
headers: {'Content-Type': 'application/json'},
Expand All @@ -336,7 +407,7 @@ export const getBookingShopifyApi = () => {
* @summary GET get payout account
*/
const customerPayoutAccountGet = (customerId: string) => {
return queryClient<CustomerPayoutAccountGet200>({
return queryClient<CustomerPayoutAccountGetResponse>({
url: `/customer/${customerId}/payout-account`,
method: 'GET',
});
Expand All @@ -347,7 +418,7 @@ export const getBookingShopifyApi = () => {
* @summary DEL destroy payout account
*/
const customerPayoutAccountDestroy = (customerId: string) => {
return queryClient<CustomerPayoutAccountDestroy200>({
return queryClient<CustomerPayoutAccountDestroyResponse>({
url: `/customer/${customerId}/payout-account`,
method: 'DELETE',
});
Expand Down Expand Up @@ -899,6 +970,11 @@ export const getBookingShopifyApi = () => {
customerLocationCreate,
customerLocationList,
customerOrderGet,
customerPayoutPaginate,
customerPayoutBalance,
customerPayoutGet,
customerPayoutCreate,
customerPayoutLogPaginate,
customerPayoutAccountCreate,
customerPayoutAccountGet,
customerPayoutAccountDestroy,
Expand Down Expand Up @@ -1031,6 +1107,35 @@ export type CustomerOrderGetResult = NonNullable<
ReturnType<ReturnType<typeof getBookingShopifyApi>['customerOrderGet']>
>
>;
export type CustomerPayoutPaginateResult = NonNullable<
Awaited<
ReturnType<
ReturnType<typeof getBookingShopifyApi>['customerPayoutPaginate']
>
>
>;
export type CustomerPayoutBalanceResult = NonNullable<
Awaited<
ReturnType<ReturnType<typeof getBookingShopifyApi>['customerPayoutBalance']>
>
>;
export type CustomerPayoutGetResult = NonNullable<
Awaited<
ReturnType<ReturnType<typeof getBookingShopifyApi>['customerPayoutGet']>
>
>;
export type CustomerPayoutCreateResult = NonNullable<
Awaited<
ReturnType<ReturnType<typeof getBookingShopifyApi>['customerPayoutCreate']>
>
>;
export type CustomerPayoutLogPaginateResult = NonNullable<
Awaited<
ReturnType<
ReturnType<typeof getBookingShopifyApi>['customerPayoutLogPaginate']
>
>
>;
export type CustomerPayoutAccountCreateResult = NonNullable<
Awaited<
ReturnType<
Expand Down
19 changes: 19 additions & 0 deletions app/lib/api/model/customerPayout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/
import type {CustomerPayoutPayoutDetails} from './customerPayoutPayoutDetails';
import type {CustomerPayoutAccountType} from './customerPayoutAccountType';
import type {CustomerPayoutStatus} from './customerPayoutStatus';

export interface CustomerPayout {
_id?: string;
amount: number;
currencyCode: string;
date: string;
payoutDetails?: CustomerPayoutPayoutDetails;
payoutType?: CustomerPayoutAccountType;
status: CustomerPayoutStatus;
}
4 changes: 2 additions & 2 deletions app/lib/api/model/customerPayoutAccountCreateBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import type {CustomerPayoutAccountCreateBodyPayoutDetails} from './customerPayoutAccountCreateBodyPayoutDetails';
import type {CustomerPayoutAccountType} from './customerPayoutAccountType';

export type CustomerPayoutAccountCreateBody = {
export interface CustomerPayoutAccountCreateBody {
payoutDetails: CustomerPayoutAccountCreateBodyPayoutDetails;
payoutType: CustomerPayoutAccountType;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
*/
import type {CustomerPayoutAccount} from './customerPayoutAccount';

export type CustomerPayoutAccountGet200Payload = CustomerPayoutAccount | null;
export interface CustomerPayoutAccountCreateResponse {
payload: CustomerPayoutAccount;
success: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0
*/

export type CustomerPayoutAccountDestroy200Payload = {
export interface CustomerPayoutAccountDestroy {
acknowledged: boolean;
deletedCount: number;
};
}
12 changes: 0 additions & 12 deletions app/lib/api/model/customerPayoutAccountDestroy200.ts

This file was deleted.

12 changes: 12 additions & 0 deletions app/lib/api/model/customerPayoutAccountDestroyResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/
import type {CustomerPayoutAccountDestroy} from './customerPayoutAccountDestroy';

export interface CustomerPayoutAccountDestroyResponse {
payload: CustomerPayoutAccountDestroy;
success: boolean;
}
12 changes: 0 additions & 12 deletions app/lib/api/model/customerPayoutAccountGet200.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type {CustomerPayoutAccount} from './customerPayoutAccount';

export type CustomerPayoutAccountCreate200 = {
export interface CustomerPayoutAccountGetResponse {
payload: CustomerPayoutAccount;
success: boolean;
};
}
12 changes: 12 additions & 0 deletions app/lib/api/model/customerPayoutBalancePayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/

export interface CustomerPayoutBalancePayload {
totalAmount: number;
totalLineItems: number;
totalShippingAmount: number;
}
12 changes: 12 additions & 0 deletions app/lib/api/model/customerPayoutBalanceResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/
import type {CustomerPayoutBalancePayload} from './customerPayoutBalancePayload';

export interface CustomerPayoutBalanceResponse {
payload: CustomerPayoutBalancePayload;
success: boolean;
}
12 changes: 12 additions & 0 deletions app/lib/api/model/customerPayoutCreateResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/
import type {CustomerPayout} from './customerPayout';

export interface CustomerPayoutCreateResponse {
payload: CustomerPayout;
success: boolean;
}
12 changes: 12 additions & 0 deletions app/lib/api/model/customerPayoutGetResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/
import type {CustomerPayout} from './customerPayout';

export interface CustomerPayoutGetResponse {
payload: CustomerPayout;
success: boolean;
}
20 changes: 20 additions & 0 deletions app/lib/api/model/customerPayoutLog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/
import type {CustomerPayoutLogReferenceDocument} from './customerPayoutLogReferenceDocument';
import type {CustomerPayoutLogType} from './customerPayoutLogType';

export interface CustomerPayoutLog {
_id: string;
createdAt: string;
customerId: number;
orderCreatedAt: string;
orderId: number;
payout: string;
referenceDocument: CustomerPayoutLogReferenceDocument;
referenceId: string;
referenceType: CustomerPayoutLogType;
}
21 changes: 21 additions & 0 deletions app/lib/api/model/customerPayoutLogPaginateParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/

export type CustomerPayoutLogPaginateParams = {
/**
* The page number
*/
page: string;
/**
* The sort order either asc eller desc = default desc
*/
sortOrder?: string;
/**
* The limit = default to 10
*/
limit?: string;
};
15 changes: 15 additions & 0 deletions app/lib/api/model/customerPayoutLogPayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/
import type {CustomerPayoutLog} from './customerPayoutLog';

export interface CustomerPayoutLogPayload {
currentPage: number;
hasNextPage: boolean;
results: CustomerPayoutLog[];
totalCount: number;
totalPages: number;
}
12 changes: 12 additions & 0 deletions app/lib/api/model/customerPayoutLogReferenceDocument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.25.0 🍺
* Do not edit manually.
* Booking Shopify Api
* OpenAPI spec version: 1.0.0
*/
import type {CustomeBaserOrderLineItem} from './customeBaserOrderLineItem';
import type {Shipping} from './shipping';

export type CustomerPayoutLogReferenceDocument =
| CustomeBaserOrderLineItem
| Shipping;
Loading

0 comments on commit 01c0ee3

Please sign in to comment.