diff --git a/app/components/AccountMenu.tsx b/app/components/AccountMenu.tsx index 1d2645dd..49fd42ce 100644 --- a/app/components/AccountMenu.tsx +++ b/app/components/AccountMenu.tsx @@ -11,6 +11,7 @@ import { IconAddressBook, IconCalendarEvent, IconClock, + IconCurrencyDollar, IconFingerprint, IconHeartHandshake, IconHome, @@ -63,6 +64,12 @@ const topMenu = [ icon: IconPlaneDeparture, isBusiness: true, }, + { + link: '/account/payouts', + label: 'Udbetalinger', + icon: IconCurrencyDollar, + isBusiness: true, + }, ]; const bottomMenu = [ diff --git a/app/components/Hero.tsx b/app/components/Hero.tsx index 2545575c..9e98d80b 100644 --- a/app/components/Hero.tsx +++ b/app/components/Hero.tsx @@ -143,6 +143,7 @@ const CardStack = ({artists: starter}: {artists: User[]}) => { h="380px" w="380px" radius="xl" + sizes="(min-width: 45em) 50vw, 100vw" src={artist.images?.profile?.url} fallbackSrc="https://placehold.co/400x600?text=Ekspert" /> diff --git a/app/lib/api/bookingShopifyApi.ts b/app/lib/api/bookingShopifyApi.ts index 5dffa8ff..5a19efa6 100644 --- a/app/lib/api/bookingShopifyApi.ts +++ b/app/lib/api/bookingShopifyApi.ts @@ -28,6 +28,10 @@ import type { CustomerLocationUpdateBody, CustomerLocationUpdateResponse, CustomerOrderGetResponse, + CustomerPayoutAccountCreate200, + CustomerPayoutAccountCreateBody, + CustomerPayoutAccountDestroy200, + CustomerPayoutAccountGet200, CustomerProductCreateVariantBody, CustomerProductCreateVariantResponse, CustomerProductDestroyResponse, @@ -94,316 +98,258 @@ import type {BodyType} from './mutator/query-client'; export const getBookingShopifyApi = () => { /** - * This endpoint respond with users images - * @summary POST get users belongs to productIds array + * This endpoint creates new user + * @summary PUT Create user */ - const productsGetUsersImage = ( - productsGetUsersImageBody: BodyType, - ) => { - return queryClient({ - url: `/products/get-users-image`, + const customerCreate = (customerCreateBody: BodyType) => { + return queryClient({ + url: `/customer`, method: 'POST', headers: {'Content-Type': 'application/json'}, - data: productsGetUsersImageBody, + data: customerCreateBody, }); }; /** - * This endpoint get all users for specific productId and variantId - * @summary GET Get all users for specific productId and variantId + * This endpoint update user + * @summary PUT Update user */ - const productsGetUsersByVariant = ( - params: ProductsGetUsersByVariantParams, + const customerUpdate = ( + customerId: string, + customerUpdateBody: BodyType, ) => { - return queryClient({ - url: `/products/get-users-by-variant`, - method: 'GET', - params, + return queryClient({ + url: `/customer/${customerId}`, + method: 'PUT', + headers: {'Content-Type': 'application/json'}, + data: customerUpdateBody, }); }; /** - * This endpoint return false or true - * @summary GET check if username is taken + * This endpoint gets customer object + * @summary GET Get customer */ - const userUsernameTaken = (username: string) => { - return queryClient({ - url: `/user/${username}/username-taken`, + const customerGet = (customerId: string) => { + return queryClient({ + url: `/customer/${customerId}`, method: 'GET', }); }; /** - * This endpoint gets user object - * @summary GET Get user + * This endpoint create new blocked + * @summary POST Create blocked */ - const userGet = (username: string) => { - return queryClient({ - url: `/user/${username}`, - method: 'GET', + const customerBlockedCreate = ( + customerId: string, + customerBlockedCreateBody: BodyType, + ) => { + return queryClient({ + url: `/customer/${customerId}/blocked`, + method: 'POST', + headers: {'Content-Type': 'application/json'}, + data: customerBlockedCreateBody, }); }; /** - * This endpoint get product for customer - * @summary GET Get product that exist in one of the schedules for customer + * This endpoint destroy blocked for customer + * @summary DEL destroy blocked */ - const userProductGet = (username: string, productHandle: string) => { - return queryClient({ - url: `/user/${username}/products/${productHandle}`, - method: 'GET', + const customerBlockedDestroy = (customerId: string, blockedId: string) => { + return queryClient({ + url: `/customer/${customerId}/blocked/${blockedId}`, + method: 'DELETE', }); }; /** - * This endpoint get products for user (across all schedules or one scheduleId) - * @summary GET Get products for user + * This endpoint get all blocked documents for customer + * @summary GET Get all blocked documents for customer */ - const userProductsListBySchedule = ( - username: string, - params?: UserProductsListByScheduleParams, + const customerBlockedList = ( + customerId: string, + params?: CustomerBlockedListParams, ) => { - return queryClient({ - url: `/user/${username}/products`, + return queryClient({ + url: `/customer/${customerId}/blocked/list`, method: 'GET', params, }); }; /** - * This endpoint is intended to be used when we need to fetch related products from the same schedule and same location. - * @summary GET Get products for user + * This endpoint get all blocked documents + * @summary GET Get all blocked documents for customer */ - const userProductsListByLocation = ( - username: string, - productHandle: string, - locationId: string, + const customerBlockedRange = ( + customerId: string, + params: CustomerBlockedRangeParams, ) => { - return queryClient({ - url: `/user/${username}/product/${productHandle}/location/${locationId}`, + return queryClient({ + url: `/customer/${customerId}/blocked/range`, method: 'GET', + params, }); }; /** - * This endpoint get products from one schedule by location - * @summary GET Get products for user + * This endpoint gets order with lineItems array of objects specific for groupId + * @summary GET Get order with lineItems array for specific groupId */ - const userProductsGetProducts = ( - username: string, - locationId: string, - userProductsGetProductsBody: BodyType, + const customerBookingGetByGroup = ( + customerId: string, + orderId: string, + groupId: string, ) => { - return queryClient({ - url: `/user/${username}/products/location/${locationId}`, - method: 'POST', - headers: {'Content-Type': 'application/json'}, - data: userProductsGetProductsBody, + return queryClient({ + url: `/customer/${customerId}/bookings/${orderId}/group/${groupId}`, + method: 'GET', }); }; /** - * This endpoint should retrieve a schedule and locations belonging to a specific productHandle, along with the product. - * @summary GET Get user schedule + * This endpoint get all bookings from orders + * @summary GET Get all bookings for customer from orders */ - const userScheduleGetByProduct = ( - username: string, - productHandle: string, + const customerBookingRange = ( + customerId: string, + params: CustomerBookingRangeParams, ) => { - return queryClient({ - url: `/user/${username}/schedule/get-by-product-id/${productHandle}`, + return queryClient({ + url: `/customer/${customerId}/bookings/range`, method: 'GET', + params, }); }; /** - * This endpoint should return all locations present in all schedules for specific user - * @summary GET Get schedules for user + * This endpoint get one location for user + * @summary GET Get one location from user */ - const userSchedulesListLocations = (username: string) => { - return queryClient({ - url: `/user/${username}/schedules/locations`, + const customerLocationGet = (customerId: string, locationId: string) => { + return queryClient({ + url: `/customer/${customerId}/location/${locationId}`, method: 'GET', }); }; /** - * This endpoint get one location for user - * @summary GET Get one location from user + * This endpoint remove location but does not delete location from db + * @summary POST Remove location from user */ - const userLocationGet = (username: string, locationId: string) => { - return queryClient({ - url: `/user/${username}/location/${locationId}`, - method: 'GET', + const customerLocationRemove = (customerId: string, locationId: string) => { + return queryClient({ + url: `/customer/${customerId}/location/${locationId}`, + method: 'DELETE', }); }; /** - * This endpoint should retrieve a schedule with products that only belong to a specific locationId. - * @summary GET Get user schedule + * This endpoint update existing location + * @summary PUT Update location */ - const userScheduleGetByLocation = ( - username: string, - scheduleId: string, + const customerLocationUpdate = ( + customerId: string, locationId: string, + customerLocationUpdateBody: BodyType, ) => { - return queryClient({ - url: `/user/${username}/schedule/${scheduleId}/location/${locationId}`, - method: 'GET', + return queryClient({ + url: `/customer/${customerId}/location/${locationId}`, + method: 'PUT', + headers: {'Content-Type': 'application/json'}, + data: customerLocationUpdateBody, }); }; /** - * This endpoint get all users group by professions - * @summary GET Get all users grouped by professions + * This endpoint set new default location for user + * @summary POST Set new default location for user */ - const usersTop = (params?: UsersTopParams) => { - return queryClient({ - url: `/users/top`, - method: 'GET', - params, + const customerLocationSetDefault = ( + customerId: string, + locationId: string, + ) => { + return queryClient({ + url: `/customer/${customerId}/location/${locationId}/setDefault`, + method: 'PUT', }); }; /** - * This endpoint get all users professions - * @summary GET Get all users professions with total count + * This endpoint creates new location + * @summary POST Create location origin or destination */ - const usersProfessions = () => { - return queryClient({ - url: `/users/professions`, - method: 'GET', + const customerLocationCreate = ( + customerId: string, + customerLocationCreateBody: BodyType, + ) => { + return queryClient({ + url: `/customer/${customerId}/locations`, + method: 'POST', + headers: {'Content-Type': 'application/json'}, + data: customerLocationCreateBody, }); }; /** - * This endpoint get all users specialties - * @summary GET Get all users specialties with total count + * This endpoint get all locations for user + * @summary GET Get all locations for user */ - const usersSpecialties = (params?: UsersSpecialtiesParams) => { - return queryClient({ - url: `/users/specialties`, + const customerLocationList = (customerId: string) => { + return queryClient({ + url: `/customer/${customerId}/locations`, method: 'GET', - params, }); }; /** - * This endpoint generate availabilty for user - * @summary POST generate availabilty for user + * This endpoint gets order with lineItems array of objects + * @summary GET Get order with lineItems array */ - const userAvailabilityGenerate = ( - username: string, - locationId: string, - userAvailabilityGenerateBody: BodyType, - ) => { - return queryClient({ - url: `/user/${username}/availability/${locationId}/generate`, - method: 'POST', - headers: {'Content-Type': 'application/json'}, - data: userAvailabilityGenerateBody, + const customerOrderGet = (customerId: string, orderId: string) => { + return queryClient({ + url: `/customer/${customerId}/orders/${orderId}`, + method: 'GET', }); }; /** - * This endpoint get's one single availabilty for user - * @summary POST get single availabilty for user + * This endpoint create new payout account + * @summary POST Create payout account */ - const userAvailabilityGet = ( - username: string, - locationId: string, - userAvailabilityGetBody: BodyType, + const customerPayoutAccountCreate = ( + customerId: string, + customerPayoutAccountCreateBody: BodyType, ) => { - return queryClient({ - url: `/user/${username}/availability/${locationId}/get`, + return queryClient({ + url: `/customer/${customerId}/payout-account`, method: 'POST', headers: {'Content-Type': 'application/json'}, - data: userAvailabilityGetBody, + data: customerPayoutAccountCreateBody, }); }; /** - * This endpoint get all users - * @summary GET Get all users + * This endpoint get payout account + * @summary GET get payout account */ - const usersList = (params?: UsersListParams) => { - return queryClient({ - url: `/users`, + const customerPayoutAccountGet = (customerId: string) => { + return queryClient({ + url: `/customer/${customerId}/payout-account`, method: 'GET', - params, }); }; /** - * This endpoint gets customer upload resource url, so customer can upload image - * @summary GET Get customer upload resource url + * This endpoint destroy payout account for customer + * @summary DEL destroy payout account */ - const customerUploadResourceURL = (customerId: string) => { - return queryClient({ - url: `/customer/${customerId}/upload/resource-url`, - method: 'GET', - }); - }; - - /** - * This endpoint update user - * @summary PUT Update user - */ - const customerUpdate = ( - customerId: string, - customerUpdateBody: BodyType, - ) => { - return queryClient({ - url: `/customer/${customerId}`, - method: 'PUT', - headers: {'Content-Type': 'application/json'}, - data: customerUpdateBody, - }); - }; - - /** - * This endpoint gets customer object - * @summary GET Get customer - */ - const customerGet = (customerId: string) => { - return queryClient({ - url: `/customer/${customerId}`, - method: 'GET', - }); - }; - - /** - * This endpoint gets customer status - * @summary GET Get customer status - */ - const customerStatus = (customerId: string) => { - return queryClient({ - url: `/customer/${customerId}/status`, - method: 'GET', - }); - }; - - /** - * This endpoint creates new user - * @summary PUT Create user - */ - const customerCreate = (customerCreateBody: BodyType) => { - return queryClient({ - url: `/customer`, - method: 'POST', - headers: {'Content-Type': 'application/json'}, - data: customerCreateBody, - }); - }; - - /** - * This endpoint return if customer is business or not - * @summary GET Get customer is business - */ - const customerIsBusiness = (customerId: string) => { - return queryClient({ - url: `/customer/${customerId}/isBusiness`, - method: 'GET', + const customerPayoutAccountDestroy = (customerId: string) => { + return queryClient({ + url: `/customer/${customerId}/payout-account`, + method: 'DELETE', }); }; @@ -486,42 +432,12 @@ export const getBookingShopifyApi = () => { }; /** - * This endpoint gets order with lineItems array of objects specific for groupId - * @summary GET Get order with lineItems array for specific groupId - */ - const customerBookingGetByGroup = ( - customerId: string, - orderId: string, - groupId: string, - ) => { - return queryClient({ - url: `/customer/${customerId}/bookings/${orderId}/group/${groupId}`, - method: 'GET', - }); - }; - - /** - * This endpoint get all bookings from orders - * @summary GET Get all bookings for customer from orders - */ - const customerBookingRange = ( - customerId: string, - params: CustomerBookingRangeParams, - ) => { - return queryClient({ - url: `/customer/${customerId}/bookings/range`, - method: 'GET', - params, - }); - }; - - /** - * This endpoint gets order with lineItems array of objects - * @summary GET Get order with lineItems array + * This endpoint gets customer upload resource url, so customer can upload image + * @summary GET Get customer upload resource url */ - const customerOrderGet = (customerId: string, orderId: string) => { - return queryClient({ - url: `/customer/${customerId}/orders/${orderId}`, + const customerUploadResourceURL = (customerId: string) => { + return queryClient({ + url: `/customer/${customerId}/upload/resource-url`, method: 'GET', }); }; @@ -610,126 +526,110 @@ export const getBookingShopifyApi = () => { }; /** - * This endpoint get all professions - * @summary GET Get all professions + * This endpoint gets customer status + * @summary GET Get customer status */ - const metaProfessions = () => { - return queryClient({ - url: `/meta/professions`, + const customerStatus = (customerId: string) => { + return queryClient({ + url: `/customer/${customerId}/status`, method: 'GET', }); }; /** - * This endpoint get all specialties - * @summary GET Get all specialties + * This endpoint return if customer is business or not + * @summary GET Get customer is business */ - const metaspecialties = () => { - return queryClient({ - url: `/meta/specialties`, + const customerIsBusiness = (customerId: string) => { + return queryClient({ + url: `/customer/${customerId}/isBusiness`, method: 'GET', }); }; /** - * This endpoint set new default location for user - * @summary POST Set new default location for user + * This endpoint get coordinates object + * @summary GET location coordinates */ - const customerLocationSetDefault = ( - customerId: string, - locationId: string, - ) => { - return queryClient({ - url: `/customer/${customerId}/location/${locationId}/setDefault`, - method: 'PUT', + const locationGetCoordinates = (params?: LocationGetCoordinatesParams) => { + return queryClient({ + url: `/location/get-coordinates`, + method: 'GET', + params, }); }; /** - * This endpoint get one location for user - * @summary GET Get one location from user + * This endpoint gets traval time object + * @summary GET location travel time */ - const customerLocationGet = (customerId: string, locationId: string) => { - return queryClient({ - url: `/customer/${customerId}/location/${locationId}`, + const locationGetTravelTime = (params?: LocationGetTravelTimeParams) => { + return queryClient({ + url: `/location/get-travel-time`, method: 'GET', + params, }); }; /** - * This endpoint remove location but does not delete location from db - * @summary POST Remove location from user + * This endpoint get all professions + * @summary GET Get all professions */ - const customerLocationRemove = (customerId: string, locationId: string) => { - return queryClient({ - url: `/customer/${customerId}/location/${locationId}`, - method: 'DELETE', + const metaProfessions = () => { + return queryClient({ + url: `/meta/professions`, + method: 'GET', }); }; /** - * This endpoint update existing location - * @summary PUT Update location + * This endpoint get all specialties + * @summary GET Get all specialties */ - const customerLocationUpdate = ( - customerId: string, - locationId: string, - customerLocationUpdateBody: BodyType, - ) => { - return queryClient({ - url: `/customer/${customerId}/location/${locationId}`, - method: 'PUT', - headers: {'Content-Type': 'application/json'}, - data: customerLocationUpdateBody, + const metaspecialties = () => { + return queryClient({ + url: `/meta/specialties`, + method: 'GET', }); }; /** - * This endpoint creates new location - * @summary POST Create location origin or destination + * This endpoint is used to upload new image for customer + * @summary POST Upload new customer image */ - const customerLocationCreate = ( - customerId: string, - customerLocationCreateBody: BodyType, - ) => { - return queryClient({ - url: `/customer/${customerId}/locations`, + const upload = (uploadBody: BodyType) => { + return queryClient({ + url: `/orchestrators/upload`, method: 'POST', headers: {'Content-Type': 'application/json'}, - data: customerLocationCreateBody, - }); - }; - - /** - * This endpoint get all locations for user - * @summary GET Get all locations for user - */ - const customerLocationList = (customerId: string) => { - return queryClient({ - url: `/customer/${customerId}/locations`, - method: 'GET', + data: uploadBody, }); }; /** - * This endpoint get coordinates object - * @summary GET location coordinates + * This endpoint respond with users images + * @summary POST get users belongs to productIds array */ - const locationGetCoordinates = (params?: LocationGetCoordinatesParams) => { - return queryClient({ - url: `/location/get-coordinates`, - method: 'GET', - params, + const productsGetUsersImage = ( + productsGetUsersImageBody: BodyType, + ) => { + return queryClient({ + url: `/products/get-users-image`, + method: 'POST', + headers: {'Content-Type': 'application/json'}, + data: productsGetUsersImageBody, }); }; /** - * This endpoint gets traval time object - * @summary GET location travel time + * This endpoint get all users for specific productId and variantId + * @summary GET Get all users for specific productId and variantId */ - const locationGetTravelTime = (params?: LocationGetTravelTimeParams) => { - return queryClient({ - url: `/location/get-travel-time`, + const productsGetUsersByVariant = ( + params: ProductsGetUsersByVariantParams, + ) => { + return queryClient({ + url: `/products/get-users-by-variant`, method: 'GET', params, }); @@ -771,255 +671,385 @@ export const getBookingShopifyApi = () => { }; /** - * This endpoint is used to upload new image for customer - * @summary POST Upload new customer image + * This endpoint generate availabilty for user + * @summary POST generate availabilty for user */ - const upload = (uploadBody: BodyType) => { - return queryClient({ - url: `/orchestrators/upload`, + const userAvailabilityGenerate = ( + username: string, + locationId: string, + userAvailabilityGenerateBody: BodyType, + ) => { + return queryClient({ + url: `/user/${username}/availability/${locationId}/generate`, method: 'POST', headers: {'Content-Type': 'application/json'}, - data: uploadBody, + data: userAvailabilityGenerateBody, }); }; /** - * This endpoint create new blocked - * @summary POST Create blocked + * This endpoint get's one single availabilty for user + * @summary POST get single availabilty for user */ - const customerBlockedCreate = ( - customerId: string, - customerBlockedCreateBody: BodyType, + const userAvailabilityGet = ( + username: string, + locationId: string, + userAvailabilityGetBody: BodyType, ) => { - return queryClient({ - url: `/customer/${customerId}/blocked`, + return queryClient({ + url: `/user/${username}/availability/${locationId}/get`, method: 'POST', headers: {'Content-Type': 'application/json'}, - data: customerBlockedCreateBody, + data: userAvailabilityGetBody, }); }; /** - * This endpoint destroy blocked for customer - * @summary DEL destroy blocked + * This endpoint get one location for user + * @summary GET Get one location from user */ - const customerBlockedDestroy = (customerId: string, blockedId: string) => { - return queryClient({ - url: `/customer/${customerId}/blocked/${blockedId}`, - method: 'DELETE', + const userLocationGet = (username: string, locationId: string) => { + return queryClient({ + url: `/user/${username}/location/${locationId}`, + method: 'GET', }); }; /** - * This endpoint get all blocked documents for customer - * @summary GET Get all blocked documents for customer + * This endpoint gets user object + * @summary GET Get user */ - const customerBlockedList = ( - customerId: string, - params?: CustomerBlockedListParams, + const userGet = (username: string) => { + return queryClient({ + url: `/user/${username}`, + method: 'GET', + }); + }; + + /** + * This endpoint return false or true + * @summary GET check if username is taken + */ + const userUsernameTaken = (username: string) => { + return queryClient({ + url: `/user/${username}/username-taken`, + method: 'GET', + }); + }; + + /** + * This endpoint get products for user (across all schedules or one scheduleId) + * @summary GET Get products for user + */ + const userProductsListBySchedule = ( + username: string, + params?: UserProductsListByScheduleParams, ) => { - return queryClient({ - url: `/customer/${customerId}/blocked/list`, + return queryClient({ + url: `/user/${username}/products`, method: 'GET', params, }); }; /** - * This endpoint get all blocked documents - * @summary GET Get all blocked documents for customer + * This endpoint get product for customer + * @summary GET Get product that exist in one of the schedules for customer */ - const customerBlockedRange = ( - customerId: string, - params: CustomerBlockedRangeParams, + const userProductGet = (username: string, productHandle: string) => { + return queryClient({ + url: `/user/${username}/products/${productHandle}`, + method: 'GET', + }); + }; + + /** + * This endpoint get products from one schedule by location + * @summary GET Get products for user + */ + const userProductsGetProducts = ( + username: string, + locationId: string, + userProductsGetProductsBody: BodyType, ) => { - return queryClient({ - url: `/customer/${customerId}/blocked/range`, + return queryClient({ + url: `/user/${username}/products/location/${locationId}`, + method: 'POST', + headers: {'Content-Type': 'application/json'}, + data: userProductsGetProductsBody, + }); + }; + + /** + * This endpoint is intended to be used when we need to fetch related products from the same schedule and same location. + * @summary GET Get products for user + */ + const userProductsListByLocation = ( + username: string, + productHandle: string, + locationId: string, + ) => { + return queryClient({ + url: `/user/${username}/product/${productHandle}/location/${locationId}`, + method: 'GET', + }); + }; + + /** + * This endpoint should retrieve a schedule and locations belonging to a specific productHandle, along with the product. + * @summary GET Get user schedule + */ + const userScheduleGetByProduct = ( + username: string, + productHandle: string, + ) => { + return queryClient({ + url: `/user/${username}/schedule/get-by-product-id/${productHandle}`, + method: 'GET', + }); + }; + + /** + * This endpoint should retrieve a schedule with products that only belong to a specific locationId. + * @summary GET Get user schedule + */ + const userScheduleGetByLocation = ( + username: string, + scheduleId: string, + locationId: string, + ) => { + return queryClient({ + url: `/user/${username}/schedule/${scheduleId}/location/${locationId}`, + method: 'GET', + }); + }; + + /** + * This endpoint should return all locations present in all schedules for specific user + * @summary GET Get schedules for user + */ + const userSchedulesListLocations = (username: string) => { + return queryClient({ + url: `/user/${username}/schedules/locations`, + method: 'GET', + }); + }; + + /** + * This endpoint get all users + * @summary GET Get all users + */ + const usersList = (params?: UsersListParams) => { + return queryClient({ + url: `/users`, + method: 'GET', + params, + }); + }; + + /** + * This endpoint get all users professions + * @summary GET Get all users professions with total count + */ + const usersProfessions = () => { + return queryClient({ + url: `/users/professions`, + method: 'GET', + }); + }; + + /** + * This endpoint get all users specialties + * @summary GET Get all users specialties with total count + */ + const usersSpecialties = (params?: UsersSpecialtiesParams) => { + return queryClient({ + url: `/users/specialties`, + method: 'GET', + params, + }); + }; + + /** + * This endpoint get all users group by professions + * @summary GET Get all users grouped by professions + */ + const usersTop = (params?: UsersTopParams) => { + return queryClient({ + url: `/users/top`, method: 'GET', params, }); }; return { - productsGetUsersImage, - productsGetUsersByVariant, - userUsernameTaken, - userGet, - userProductGet, - userProductsListBySchedule, - userProductsListByLocation, - userProductsGetProducts, - userScheduleGetByProduct, - userSchedulesListLocations, - userLocationGet, - userScheduleGetByLocation, - usersTop, - usersProfessions, - usersSpecialties, - userAvailabilityGenerate, - userAvailabilityGet, - usersList, - customerUploadResourceURL, + customerCreate, customerUpdate, customerGet, - customerStatus, - customerCreate, - customerIsBusiness, + customerBlockedCreate, + customerBlockedDestroy, + customerBlockedList, + customerBlockedRange, + customerBookingGetByGroup, + customerBookingRange, + customerLocationGet, + customerLocationRemove, + customerLocationUpdate, + customerLocationSetDefault, + customerLocationCreate, + customerLocationList, + customerOrderGet, + customerPayoutAccountCreate, + customerPayoutAccountGet, + customerPayoutAccountDestroy, customerProductsList, customerProductsListIds, customerProductGet, customerProductUpsert, customerProductDestroy, customerProductCreateVariant, - customerBookingGetByGroup, - customerBookingRange, - customerOrderGet, + customerUploadResourceURL, customerScheduleCreate, customerScheduleList, customerScheduleGet, customerScheduleUpdate, customerScheduleDestroy, customerScheduleSlotUpdate, - metaProfessions, - metaspecialties, - customerLocationSetDefault, - customerLocationGet, - customerLocationRemove, - customerLocationUpdate, - customerLocationCreate, - customerLocationList, + customerStatus, + customerIsBusiness, locationGetCoordinates, locationGetTravelTime, + metaProfessions, + metaspecialties, + upload, + productsGetUsersImage, + productsGetUsersByVariant, shippingCreate, shippingCalculate, - shippingGet, - upload, - customerBlockedCreate, - customerBlockedDestroy, - customerBlockedList, - customerBlockedRange, + shippingGet, + userAvailabilityGenerate, + userAvailabilityGet, + userLocationGet, + userGet, + userUsernameTaken, + userProductsListBySchedule, + userProductGet, + userProductsGetProducts, + userProductsListByLocation, + userScheduleGetByProduct, + userScheduleGetByLocation, + userSchedulesListLocations, + usersList, + usersProfessions, + usersSpecialties, + usersTop, }; }; -export type ProductsGetUsersImageResult = NonNullable< +export type CustomerCreateResult = NonNullable< + Awaited['customerCreate']>> +>; +export type CustomerUpdateResult = NonNullable< + Awaited['customerUpdate']>> +>; +export type CustomerGetResult = NonNullable< + Awaited['customerGet']>> +>; +export type CustomerBlockedCreateResult = NonNullable< Awaited< - ReturnType['productsGetUsersImage']> + ReturnType['customerBlockedCreate']> > >; -export type ProductsGetUsersByVariantResult = NonNullable< +export type CustomerBlockedDestroyResult = NonNullable< Awaited< ReturnType< - ReturnType['productsGetUsersByVariant'] + ReturnType['customerBlockedDestroy'] > > >; -export type UserUsernameTakenResult = NonNullable< +export type CustomerBlockedListResult = NonNullable< Awaited< - ReturnType['userUsernameTaken']> + ReturnType['customerBlockedList']> > >; -export type UserGetResult = NonNullable< - Awaited['userGet']>> ->; -export type UserProductGetResult = NonNullable< - Awaited['userProductGet']>> +export type CustomerBlockedRangeResult = NonNullable< + Awaited< + ReturnType['customerBlockedRange']> + > >; -export type UserProductsListByScheduleResult = NonNullable< +export type CustomerBookingGetByGroupResult = NonNullable< Awaited< ReturnType< - ReturnType['userProductsListBySchedule'] + ReturnType['customerBookingGetByGroup'] > > >; -export type UserProductsListByLocationResult = NonNullable< +export type CustomerBookingRangeResult = NonNullable< Awaited< - ReturnType< - ReturnType['userProductsListByLocation'] - > + ReturnType['customerBookingRange']> > >; -export type UserProductsGetProductsResult = NonNullable< +export type CustomerLocationGetResult = NonNullable< Awaited< - ReturnType< - ReturnType['userProductsGetProducts'] - > + ReturnType['customerLocationGet']> > >; -export type UserScheduleGetByProductResult = NonNullable< +export type CustomerLocationRemoveResult = NonNullable< Awaited< ReturnType< - ReturnType['userScheduleGetByProduct'] + ReturnType['customerLocationRemove'] > > >; -export type UserSchedulesListLocationsResult = NonNullable< +export type CustomerLocationUpdateResult = NonNullable< Awaited< ReturnType< - ReturnType['userSchedulesListLocations'] + ReturnType['customerLocationUpdate'] > > >; -export type UserLocationGetResult = NonNullable< +export type CustomerLocationSetDefaultResult = NonNullable< Awaited< - ReturnType['userLocationGet']> + ReturnType< + ReturnType['customerLocationSetDefault'] + > > >; -export type UserScheduleGetByLocationResult = NonNullable< +export type CustomerLocationCreateResult = NonNullable< Awaited< ReturnType< - ReturnType['userScheduleGetByLocation'] + ReturnType['customerLocationCreate'] > > >; -export type UsersTopResult = NonNullable< - Awaited['usersTop']>> ->; -export type UsersProfessionsResult = NonNullable< +export type CustomerLocationListResult = NonNullable< Awaited< - ReturnType['usersProfessions']> + ReturnType['customerLocationList']> > >; -export type UsersSpecialtiesResult = NonNullable< +export type CustomerOrderGetResult = NonNullable< Awaited< - ReturnType['usersSpecialties']> + ReturnType['customerOrderGet']> > >; -export type UserAvailabilityGenerateResult = NonNullable< +export type CustomerPayoutAccountCreateResult = NonNullable< Awaited< ReturnType< - ReturnType['userAvailabilityGenerate'] + ReturnType['customerPayoutAccountCreate'] > > >; -export type UserAvailabilityGetResult = NonNullable< - Awaited< - ReturnType['userAvailabilityGet']> - > ->; -export type UsersListResult = NonNullable< - Awaited['usersList']>> ->; -export type CustomerUploadResourceURLResult = NonNullable< +export type CustomerPayoutAccountGetResult = NonNullable< Awaited< ReturnType< - ReturnType['customerUploadResourceURL'] + ReturnType['customerPayoutAccountGet'] > > >; -export type CustomerUpdateResult = NonNullable< - Awaited['customerUpdate']>> ->; -export type CustomerGetResult = NonNullable< - Awaited['customerGet']>> ->; -export type CustomerStatusResult = NonNullable< - Awaited['customerStatus']>> ->; -export type CustomerCreateResult = NonNullable< - Awaited['customerCreate']>> ->; -export type CustomerIsBusinessResult = NonNullable< +export type CustomerPayoutAccountDestroyResult = NonNullable< Awaited< - ReturnType['customerIsBusiness']> + ReturnType< + ReturnType['customerPayoutAccountDestroy'] + > > >; export type CustomerProductsListResult = NonNullable< @@ -1058,23 +1088,13 @@ export type CustomerProductCreateVariantResult = NonNullable< > > >; -export type CustomerBookingGetByGroupResult = NonNullable< +export type CustomerUploadResourceURLResult = NonNullable< Awaited< ReturnType< - ReturnType['customerBookingGetByGroup'] + ReturnType['customerUploadResourceURL'] > > >; -export type CustomerBookingRangeResult = NonNullable< - Awaited< - ReturnType['customerBookingRange']> - > ->; -export type CustomerOrderGetResult = NonNullable< - Awaited< - ReturnType['customerOrderGet']> - > ->; export type CustomerScheduleCreateResult = NonNullable< Awaited< ReturnType< @@ -1113,6 +1133,26 @@ export type CustomerScheduleSlotUpdateResult = NonNullable< > > >; +export type CustomerStatusResult = NonNullable< + Awaited['customerStatus']>> +>; +export type CustomerIsBusinessResult = NonNullable< + Awaited< + ReturnType['customerIsBusiness']> + > +>; +export type LocationGetCoordinatesResult = NonNullable< + Awaited< + ReturnType< + ReturnType['locationGetCoordinates'] + > + > +>; +export type LocationGetTravelTimeResult = NonNullable< + Awaited< + ReturnType['locationGetTravelTime']> + > +>; export type MetaProfessionsResult = NonNullable< Awaited< ReturnType['metaProfessions']> @@ -1123,89 +1163,115 @@ export type MetaspecialtiesResult = NonNullable< ReturnType['metaspecialties']> > >; -export type CustomerLocationSetDefaultResult = NonNullable< +export type UploadResult = NonNullable< + Awaited['upload']>> +>; +export type ProductsGetUsersImageResult = NonNullable< + Awaited< + ReturnType['productsGetUsersImage']> + > +>; +export type ProductsGetUsersByVariantResult = NonNullable< Awaited< ReturnType< - ReturnType['customerLocationSetDefault'] + ReturnType['productsGetUsersByVariant'] > > >; -export type CustomerLocationGetResult = NonNullable< +export type ShippingCreateResult = NonNullable< + Awaited['shippingCreate']>> +>; +export type ShippingCalculateResult = NonNullable< Awaited< - ReturnType['customerLocationGet']> + ReturnType['shippingCalculate']> > >; -export type CustomerLocationRemoveResult = NonNullable< +export type ShippingGetResult = NonNullable< + Awaited['shippingGet']>> +>; +export type UserAvailabilityGenerateResult = NonNullable< Awaited< ReturnType< - ReturnType['customerLocationRemove'] + ReturnType['userAvailabilityGenerate'] > > >; -export type CustomerLocationUpdateResult = NonNullable< +export type UserAvailabilityGetResult = NonNullable< Awaited< - ReturnType< - ReturnType['customerLocationUpdate'] - > + ReturnType['userAvailabilityGet']> > >; -export type CustomerLocationCreateResult = NonNullable< +export type UserLocationGetResult = NonNullable< Awaited< - ReturnType< - ReturnType['customerLocationCreate'] - > + ReturnType['userLocationGet']> > >; -export type CustomerLocationListResult = NonNullable< +export type UserGetResult = NonNullable< + Awaited['userGet']>> +>; +export type UserUsernameTakenResult = NonNullable< Awaited< - ReturnType['customerLocationList']> + ReturnType['userUsernameTaken']> > >; -export type LocationGetCoordinatesResult = NonNullable< +export type UserProductsListByScheduleResult = NonNullable< Awaited< ReturnType< - ReturnType['locationGetCoordinates'] + ReturnType['userProductsListBySchedule'] > > >; -export type LocationGetTravelTimeResult = NonNullable< +export type UserProductGetResult = NonNullable< + Awaited['userProductGet']>> +>; +export type UserProductsGetProductsResult = NonNullable< Awaited< - ReturnType['locationGetTravelTime']> + ReturnType< + ReturnType['userProductsGetProducts'] + > > >; -export type ShippingCreateResult = NonNullable< - Awaited['shippingCreate']>> ->; -export type ShippingCalculateResult = NonNullable< +export type UserProductsListByLocationResult = NonNullable< Awaited< - ReturnType['shippingCalculate']> + ReturnType< + ReturnType['userProductsListByLocation'] + > > >; -export type ShippingGetResult = NonNullable< - Awaited['shippingGet']>> ->; -export type UploadResult = NonNullable< - Awaited['upload']>> +export type UserScheduleGetByProductResult = NonNullable< + Awaited< + ReturnType< + ReturnType['userScheduleGetByProduct'] + > + > >; -export type CustomerBlockedCreateResult = NonNullable< +export type UserScheduleGetByLocationResult = NonNullable< Awaited< - ReturnType['customerBlockedCreate']> + ReturnType< + ReturnType['userScheduleGetByLocation'] + > > >; -export type CustomerBlockedDestroyResult = NonNullable< +export type UserSchedulesListLocationsResult = NonNullable< Awaited< ReturnType< - ReturnType['customerBlockedDestroy'] + ReturnType['userSchedulesListLocations'] > > >; -export type CustomerBlockedListResult = NonNullable< +export type UsersListResult = NonNullable< + Awaited['usersList']>> +>; +export type UsersProfessionsResult = NonNullable< Awaited< - ReturnType['customerBlockedList']> + ReturnType['usersProfessions']> > >; -export type CustomerBlockedRangeResult = NonNullable< +export type UsersSpecialtiesResult = NonNullable< Awaited< - ReturnType['customerBlockedRange']> + ReturnType['usersSpecialties']> > >; +export type UsersTopResult = NonNullable< + Awaited['usersTop']>> +>; diff --git a/app/lib/api/model/customerPayoutAccount.ts b/app/lib/api/model/customerPayoutAccount.ts new file mode 100644 index 00000000..f04a1154 --- /dev/null +++ b/app/lib/api/model/customerPayoutAccount.ts @@ -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 {CustomerPayoutAccountCustomerId} from './customerPayoutAccountCustomerId'; +import type {CustomerPayoutAccountPayoutDetails} from './customerPayoutAccountPayoutDetails'; +import type {CustomerPayoutAccountType} from './customerPayoutAccountType'; + +export interface CustomerPayoutAccount { + customerId: CustomerPayoutAccountCustomerId; + payoutDetails: CustomerPayoutAccountPayoutDetails; + payoutType: CustomerPayoutAccountType; +} diff --git a/app/lib/api/model/customerPayoutAccountCreate200.ts b/app/lib/api/model/customerPayoutAccountCreate200.ts new file mode 100644 index 00000000..e530a570 --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountCreate200.ts @@ -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 {CustomerPayoutAccount} from './customerPayoutAccount'; + +export type CustomerPayoutAccountCreate200 = { + payload: CustomerPayoutAccount; + success: boolean; +}; diff --git a/app/lib/api/model/customerPayoutAccountCreateBody.ts b/app/lib/api/model/customerPayoutAccountCreateBody.ts new file mode 100644 index 00000000..6c16e0c8 --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountCreateBody.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v6.25.0 🍺 + * Do not edit manually. + * Booking Shopify Api + * OpenAPI spec version: 1.0.0 + */ +import type {CustomerPayoutAccountCreateBodyPayoutDetails} from './customerPayoutAccountCreateBodyPayoutDetails'; +import type {CustomerPayoutAccountType} from './customerPayoutAccountType'; + +export type CustomerPayoutAccountCreateBody = { + payoutDetails: CustomerPayoutAccountCreateBodyPayoutDetails; + payoutType: CustomerPayoutAccountType; +}; diff --git a/app/lib/api/model/customerPayoutAccountCreateBodyPayoutDetails.ts b/app/lib/api/model/customerPayoutAccountCreateBodyPayoutDetails.ts new file mode 100644 index 00000000..02f05440 --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountCreateBodyPayoutDetails.ts @@ -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 {CustomerPayoutMobilePay} from './customerPayoutMobilePay'; +import type {CustomerPayoutBankAccount} from './customerPayoutBankAccount'; + +export type CustomerPayoutAccountCreateBodyPayoutDetails = + | CustomerPayoutMobilePay + | CustomerPayoutBankAccount; diff --git a/app/lib/api/model/customerPayoutAccountCustomerId.ts b/app/lib/api/model/customerPayoutAccountCustomerId.ts new file mode 100644 index 00000000..846bdf1a --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountCustomerId.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v6.25.0 🍺 + * Do not edit manually. + * Booking Shopify Api + * OpenAPI spec version: 1.0.0 + */ + +export type CustomerPayoutAccountCustomerId = string | number; diff --git a/app/lib/api/model/customerPayoutAccountDestroy200.ts b/app/lib/api/model/customerPayoutAccountDestroy200.ts new file mode 100644 index 00000000..26460384 --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountDestroy200.ts @@ -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 {CustomerPayoutAccountDestroy200Payload} from './customerPayoutAccountDestroy200Payload'; + +export type CustomerPayoutAccountDestroy200 = { + payload: CustomerPayoutAccountDestroy200Payload; + success: boolean; +}; diff --git a/app/lib/api/model/customerPayoutAccountDestroy200Payload.ts b/app/lib/api/model/customerPayoutAccountDestroy200Payload.ts new file mode 100644 index 00000000..4efbb45a --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountDestroy200Payload.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.25.0 🍺 + * Do not edit manually. + * Booking Shopify Api + * OpenAPI spec version: 1.0.0 + */ + +export type CustomerPayoutAccountDestroy200Payload = { + acknowledged: boolean; + deletedCount: number; +}; diff --git a/app/lib/api/model/customerPayoutAccountGet200.ts b/app/lib/api/model/customerPayoutAccountGet200.ts new file mode 100644 index 00000000..ba8b23ac --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountGet200.ts @@ -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 {CustomerPayoutAccountGet200Payload} from './customerPayoutAccountGet200Payload'; + +export type CustomerPayoutAccountGet200 = { + payload: CustomerPayoutAccountGet200Payload; + success: boolean; +}; diff --git a/app/lib/api/model/customerPayoutAccountGet200Payload.ts b/app/lib/api/model/customerPayoutAccountGet200Payload.ts new file mode 100644 index 00000000..ded55c9f --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountGet200Payload.ts @@ -0,0 +1,9 @@ +/** + * Generated by orval v6.25.0 🍺 + * Do not edit manually. + * Booking Shopify Api + * OpenAPI spec version: 1.0.0 + */ +import type {CustomerPayoutAccount} from './customerPayoutAccount'; + +export type CustomerPayoutAccountGet200Payload = CustomerPayoutAccount | null; diff --git a/app/lib/api/model/customerPayoutAccountPayoutDetails.ts b/app/lib/api/model/customerPayoutAccountPayoutDetails.ts new file mode 100644 index 00000000..99e4eb48 --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountPayoutDetails.ts @@ -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 {CustomerPayoutMobilePay} from './customerPayoutMobilePay'; +import type {CustomerPayoutBankAccount} from './customerPayoutBankAccount'; + +export type CustomerPayoutAccountPayoutDetails = + | CustomerPayoutMobilePay + | CustomerPayoutBankAccount; diff --git a/app/lib/api/model/customerPayoutAccountType.ts b/app/lib/api/model/customerPayoutAccountType.ts new file mode 100644 index 00000000..56d68ab6 --- /dev/null +++ b/app/lib/api/model/customerPayoutAccountType.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v6.25.0 🍺 + * Do not edit manually. + * Booking Shopify Api + * OpenAPI spec version: 1.0.0 + */ + +export type CustomerPayoutAccountType = + (typeof CustomerPayoutAccountType)[keyof typeof CustomerPayoutAccountType]; + +// eslint-disable-next-line @typescript-eslint/no-redeclare +export const CustomerPayoutAccountType = { + MOBILE_PAY: 'MOBILE_PAY', + BANK_ACCOUNT: 'BANK_ACCOUNT', +} as const; diff --git a/app/lib/api/model/customerPayoutBankAccount.ts b/app/lib/api/model/customerPayoutBankAccount.ts new file mode 100644 index 00000000..a1fb9041 --- /dev/null +++ b/app/lib/api/model/customerPayoutBankAccount.ts @@ -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 CustomerPayoutBankAccount { + accountNum: number; + bankName: string; + regNum: number; +} diff --git a/app/lib/api/model/customerPayoutMobilePay.ts b/app/lib/api/model/customerPayoutMobilePay.ts new file mode 100644 index 00000000..c07c3978 --- /dev/null +++ b/app/lib/api/model/customerPayoutMobilePay.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.25.0 🍺 + * Do not edit manually. + * Booking Shopify Api + * OpenAPI spec version: 1.0.0 + */ +import type {CustomerPayoutMobilePayPhoneNumber} from './customerPayoutMobilePayPhoneNumber'; + +export interface CustomerPayoutMobilePay { + phoneNumber: CustomerPayoutMobilePayPhoneNumber; +} diff --git a/app/lib/api/model/customerPayoutMobilePayPhoneNumber.ts b/app/lib/api/model/customerPayoutMobilePayPhoneNumber.ts new file mode 100644 index 00000000..fcfc60d4 --- /dev/null +++ b/app/lib/api/model/customerPayoutMobilePayPhoneNumber.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v6.25.0 🍺 + * Do not edit manually. + * Booking Shopify Api + * OpenAPI spec version: 1.0.0 + */ + +export type CustomerPayoutMobilePayPhoneNumber = string | number; diff --git a/app/lib/api/model/index.ts b/app/lib/api/model/index.ts index a39b2dd7..979763ac 100644 --- a/app/lib/api/model/index.ts +++ b/app/lib/api/model/index.ts @@ -76,6 +76,20 @@ export * from './customerOrderAllOf'; export * from './customerOrderGetResponse'; export * from './customerOrderLineItem'; export * from './customerOrderLineItemAllOf'; +export * from './customerPayoutAccount'; +export * from './customerPayoutAccountCreate200'; +export * from './customerPayoutAccountCreateBody'; +export * from './customerPayoutAccountCreateBodyPayoutDetails'; +export * from './customerPayoutAccountCustomerId'; +export * from './customerPayoutAccountDestroy200'; +export * from './customerPayoutAccountDestroy200Payload'; +export * from './customerPayoutAccountGet200'; +export * from './customerPayoutAccountGet200Payload'; +export * from './customerPayoutAccountPayoutDetails'; +export * from './customerPayoutAccountType'; +export * from './customerPayoutBankAccount'; +export * from './customerPayoutMobilePay'; +export * from './customerPayoutMobilePayPhoneNumber'; export * from './customerProduct'; export * from './customerProductAllOf'; export * from './customerProductBase'; diff --git a/app/lib/zod/bookingShopifyApi.ts b/app/lib/zod/bookingShopifyApi.ts index dace14ec..73ba64c1 100644 --- a/app/lib/zod/bookingShopifyApi.ts +++ b/app/lib/zod/bookingShopifyApi.ts @@ -7,88 +7,95 @@ import {z as zod} from 'zod'; /** - * This endpoint respond with users images - * @summary POST get users belongs to productIds array + * This endpoint creates new user + * @summary PUT Create user */ -export const productsGetUsersImageBody = zod.object({ - productIds: zod.array(zod.string()), -}); +export const customerCreateBodyUsernameRegExp = new RegExp('^[a-zA-Z0-9-_]+$'); -export const productsGetUsersImageResponse = zod.object({ - success: zod.boolean(), - payload: zod.array( - zod.object({ - productId: zod.number(), - totalUsers: zod.number(), - users: zod.array( - zod.object({ - customerId: zod.number(), - username: zod.string(), - images: zod.object({ - profile: zod - .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), - }) - .optional(), - }), - fullname: zod.string(), - }), - ), - }), - ), +export const customerCreateBody = zod.object({ + customerId: zod.number(), + fullname: zod.string(), + email: zod.string().email(), + phone: zod.string(), + username: zod.string().regex(customerCreateBodyUsernameRegExp), + yearsExperience: zod.string(), + professions: zod.array(zod.string()), + specialties: zod.array(zod.string()), + aboutMe: zod.string(), + shortDescription: zod.string(), + gender: zod.string(), + social: zod.object({ + youtube: zod.string().optional(), + x: zod.string().optional(), + instagram: zod.string().optional(), + facebook: zod.string().optional(), + }), + speaks: zod.array(zod.string()), }); -/** - * This endpoint get all users for specific productId and variantId - * @summary GET Get all users for specific productId and variantId - */ -export const productsGetUsersByVariantResponse = zod.object({ +export const customerCreateResponse = zod.object({ success: zod.boolean(), payload: zod.object({ - productId: zod.number(), - totalUsers: zod.number(), - nextCursor: zod.string().optional(), - result: zod.array( - zod.object({ - customerId: zod.number(), - username: zod.string(), - shortDescription: zod.string(), - images: zod.object({ - profile: zod.object({ - url: zod.string().url(), - width: zod.number(), - height: zod.number(), - }), - }), - fullname: zod.string(), - variantId: zod.number(), - }), - ), + customerId: zod.number(), + fullname: zod.string(), + email: zod.string().email(), + phone: zod.string(), + username: zod.string(), + yearsExperience: zod.string(), + professions: zod.array(zod.string()), + specialties: zod.array(zod.string()), + aboutMe: zod.string(), + shortDescription: zod.string(), + gender: zod.string(), + social: zod.object({ + youtube: zod.string().optional(), + x: zod.string().optional(), + instagram: zod.string().optional(), + facebook: zod.string().optional(), + }), + speaks: zod.array(zod.string()), + images: zod.object({ + profile: zod + .object({ + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), + }) + .optional(), + }), }), }); /** - * This endpoint return false or true - * @summary GET check if username is taken + * This endpoint update user + * @summary PUT Update user */ -export const userUsernameTakenParams = zod.object({ - username: zod.string(), +export const customerUpdateParams = zod.object({ + customerId: zod.string(), }); -export const userUsernameTakenResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - usernameTaken: zod.boolean(), - }), +export const customerUpdateBody = zod.object({ + fullname: zod.string().optional(), + email: zod.string().email().optional(), + phone: zod.string().optional(), + yearsExperience: zod.string().optional(), + professions: zod.array(zod.string()).optional(), + specialties: zod.array(zod.string()).optional(), + aboutMe: zod.string().optional(), + shortDescription: zod.string().optional(), + gender: zod.string().optional(), + social: zod + .object({ + youtube: zod.string().optional(), + facebook: zod.string().optional(), + instagram: zod.string().optional(), + x: zod.string().optional(), + }) + .optional(), + speaks: zod.array(zod.string()).optional(), }); -/** - * This endpoint gets user object - * @summary GET Get user - */ -export const userGetResponse = zod.object({ +export const customerUpdateResponse = zod.object({ success: zod.boolean(), payload: zod.object({ customerId: zod.number(), @@ -122,599 +129,504 @@ export const userGetResponse = zod.object({ }); /** - * This endpoint get product for customer - * @summary GET Get product that exist in one of the schedules for customer + * This endpoint gets customer object + * @summary GET Get customer */ -export const userProductGetParams = zod.object({ - username: zod.string(), - productHandle: zod.string(), +export const customerGetParams = zod.object({ + customerId: zod.string(), }); -export const userProductGetResponse = zod.object({ +export const customerGetResponse = zod.object({ success: zod.boolean(), - payload: zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod + payload: zod.object({ + customerId: zod.number(), + fullname: zod.string(), + email: zod.string().email(), + phone: zod.string(), + username: zod.string(), + yearsExperience: zod.string(), + professions: zod.array(zod.string()), + specialties: zod.array(zod.string()), + aboutMe: zod.string(), + shortDescription: zod.string(), + gender: zod.string(), + social: zod.object({ + youtube: zod.string().optional(), + x: zod.string().optional(), + instagram: zod.string().optional(), + facebook: zod.string().optional(), + }), + speaks: zod.array(zod.string()), + images: zod.object({ + profile: zod .object({ - amount: zod.string(), - currencyCode: zod.string(), + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), }) .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - }) - .and( - zod.object({ - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), - }), - ), - }), - ) - .and( - zod.object({ - scheduleId: zod.string(), - scheduleName: zod.string(), - }), - ), + }), + }), }); /** - * This endpoint get products for user (across all schedules or one scheduleId) - * @summary GET Get products for user + * This endpoint create new blocked + * @summary POST Create blocked */ -export const userProductsListByScheduleParams = zod.object({ - username: zod.string(), +export const customerBlockedCreateBody = zod.object({ + title: zod.string(), + start: zod.string(), + end: zod.string(), }); -export const userProductsListByScheduleQueryParams = zod.object({ - scheduleId: zod.string().optional(), +export const customerBlockedCreateResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + _id: zod.string().optional(), + customerId: zod.number(), + start: zod.string(), + end: zod.string(), + title: zod.string(), + type: zod.string(), + }), }); -export const userProductsListByScheduleResponse = zod.object({ +/** + * This endpoint destroy blocked for customer + * @summary DEL destroy blocked + */ +export const customerBlockedDestroyParams = zod.object({ + customerId: zod.string(), + blockedId: zod.string(), +}); + +export const customerBlockedDestroyResponse = zod.object({ success: zod.boolean(), - payload: zod.array( - zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - }) - .and( - zod.object({ - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), - }), - ), - }), - ) - .and( - zod.object({ - scheduleId: zod.string(), - scheduleName: zod.string(), - }), - ), - ), + payload: zod.object({ + deletedCount: zod.number(), + acknowledged: zod.boolean(), + }), }); /** - * This endpoint is intended to be used when we need to fetch related products from the same schedule and same location. - * @summary GET Get products for user + * This endpoint get all blocked documents for customer + * @summary GET Get all blocked documents for customer */ -export const userProductsListByLocationParams = zod.object({ - username: zod.string(), - productHandle: zod.string(), - locationId: zod.string(), +export const customerBlockedListParams = zod.object({ + customerId: zod.string(), }); -export const userProductsListByLocationResponse = zod.object({ +export const customerBlockedListQueryParams = zod.object({ + nextCursor: zod.string().optional(), + limit: zod.string().optional(), +}); + +export const customerBlockedListResponse = zod.object({ success: zod.boolean(), - payload: zod.array( - zod.object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), + payload: zod.object({ + nextCursor: zod.string().optional(), + totalCount: zod.number(), + results: zod.array( + zod.object({ + _id: zod.string().optional(), + customerId: zod.number(), + start: zod.string(), + end: zod.string(), + title: zod.string(), + type: zod.string(), }), - }), - ), + ), + }), }); /** - * This endpoint get products from one schedule by location - * @summary GET Get products for user + * This endpoint get all blocked documents + * @summary GET Get all blocked documents for customer */ -export const userProductsGetProductsParams = zod.object({ - username: zod.string(), - locationId: zod.string(), +export const customerBlockedRangeParams = zod.object({ + customerId: zod.string(), }); -export const userProductsGetProductsBody = zod.object({ - productHandlers: zod.array(zod.string()), +export const customerBlockedRangeQueryParams = zod.object({ + start: zod.string(), + end: zod.string(), }); -export const userProductsGetProductsResponse = zod.object({ +export const customerBlockedRangeResponse = zod.object({ success: zod.boolean(), payload: zod.array( zod.object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), + _id: zod.string().optional(), + customerId: zod.number(), + start: zod.string(), + end: zod.string(), + title: zod.string(), + type: zod.string(), }), ), }); /** - * This endpoint should retrieve a schedule and locations belonging to a specific productHandle, along with the product. - * @summary GET Get user schedule + * This endpoint gets order with lineItems array of objects specific for groupId + * @summary GET Get order with lineItems array for specific groupId */ -export const userScheduleGetByProductParams = zod.object({ - username: zod.string(), - productHandle: zod.string(), +export const customerBookingGetByGroupParams = zod.object({ + customerId: zod.string(), + orderId: zod.string(), + groupId: zod.string(), }); -export const userScheduleGetByProductResponse = zod.object({ +export const customerBookingGetByGroupResponse = zod.object({ success: zod.boolean(), payload: zod .object({ - _id: zod.string(), - name: zod.string(), - customerId: zod.number(), - slots: zod.array( - zod.object({ - day: zod.enum([ - 'monday', - 'tuesday', - 'wednesday', - 'thursday', - 'friday', - 'saturday', - 'sunday', - ]), - intervals: zod.array( - zod.object({ - from: zod.string(), - to: zod.string(), - }), - ), + id: zod.number(), + order_number: zod.number(), + admin_graphql_api_id: zod.string(), + buyer_accepts_marketing: zod.boolean(), + cancel_reason: zod.string().optional(), + cancelled_at: zod.string().optional(), + client_details: zod + .object({ + accept_language: zod.string().optional(), + browser_height: zod.number().optional(), + browser_ip: zod.string().optional(), + browser_width: zod.number().optional(), + session_hash: zod.string().optional(), + user_agent: zod.string().optional(), + }) + .optional(), + closed_at: zod.string().optional(), + confirmed: zod.boolean(), + contact_email: zod.string().optional(), + created_at: zod.string(), + currency: zod.string(), + current_subtotal_price: zod.string(), + current_subtotal_price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - ), - locations: zod.array( - zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), - ), - }) - .and( - zod.object({ - product: zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - }) - .and( - zod.object({ - locations: zod.array( - zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), - ), - }), - ), }), - ), -}); - -/** - * This endpoint should return all locations present in all schedules for specific user - * @summary GET Get schedules for user - */ -export const userSchedulesListLocationsParams = zod.object({ - username: zod.string(), -}); - -export const userSchedulesListLocationsResponse = zod.object({ - success: zod.boolean(), - payload: zod.array( - zod.object({ - _id: zod.string(), - name: zod.string(), - customerId: zod.number(), - slots: zod.array( - zod.object({ - day: zod.enum([ - 'monday', - 'tuesday', - 'wednesday', - 'thursday', - 'friday', - 'saturday', - 'sunday', - ]), - intervals: zod.array( - zod.object({ - from: zod.string(), - to: zod.string(), - }), - ), + current_total_additional_fees_set: zod + .object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }) + .optional(), + current_total_discounts: zod.string(), + current_total_discounts_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - ), - locations: zod.array( - zod + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + current_total_duties_set: zod + .object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }) + .optional(), + current_total_price: zod.string(), + current_total_price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + current_total_tax: zod.string(), + current_total_tax_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + customer: zod.object({ + id: zod.number(), + email: zod.string().optional(), + accepts_marketing: zod.boolean(), + created_at: zod.string(), + updated_at: zod.string(), + first_name: zod.string(), + last_name: zod.string(), + state: zod.string(), + note: zod.string().optional(), + verified_email: zod.boolean(), + multipass_identifier: zod.string().optional(), + tax_exempt: zod.boolean(), + phone: zod.string().optional(), + email_marketing_consent: zod.boolean().optional(), + sms_marketing_consent: zod .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), + state: zod.string().optional(), + opt_in_level: zod.string().optional(), + consent_updated_at: zod.string().optional(), + consent_collected_from: zod.string().optional(), + }) + .optional(), + tags: zod.string(), + currency: zod.string(), + accepts_marketing_updated_at: zod.string().optional(), + marketing_opt_in_level: zod.string().optional(), + tax_exemptions: zod.array(zod.string()).optional(), + admin_graphql_api_id: zod.string(), + default_address: zod + .object({ + customer_id: zod.number().optional(), + first_name: zod.string(), + address1: zod.string().optional(), + phone: zod.string().optional(), + city: zod.string().optional(), + zip: zod.string().optional(), + province: zod.string().optional(), + country: zod.string().optional(), + last_name: zod.string(), + address2: zod.string().optional(), + company: zod.string().optional(), + latitude: zod.number().optional(), + longitude: zod.number().optional(), name: zod.string(), - fullAddress: zod.string(), + country_code: zod.string(), + country_name: zod.string().optional(), + province_code: zod.string().optional(), + default: zod.boolean(), }) - .and( + .optional(), + }), + fulfillments: zod.array( + zod.object({ + id: zod.number(), + admin_graphql_api_id: zod.string(), + created_at: zod.string(), + location_id: zod.number(), + name: zod.string(), + order_id: zod.number(), + service: zod.string(), + shipment_status: zod.string().optional(), + status: zod.string(), + tracking_company: zod.string().optional(), + tracking_number: zod.string().optional(), + tracking_numbers: zod.array(zod.string()).optional(), + tracking_url: zod.string().optional(), + tracking_urls: zod.array(zod.string()).optional(), + updated_at: zod.string().optional(), + line_items: zod.array( zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), + id: zod.number(), + name: zod.string(), }), ), + }), ), - }), - ), -}); - -/** - * This endpoint get one location for user - * @summary GET Get one location from user - */ -export const userLocationGetParams = zod.object({ - username: zod.string(), - locationId: zod.string(), -}); - -export const userLocationGetResponse = zod.object({ - success: zod.boolean(), - payload: zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), -}); - -/** - * This endpoint should retrieve a schedule with products that only belong to a specific locationId. - * @summary GET Get user schedule - */ -export const userScheduleGetByLocationParams = zod.object({ - username: zod.string(), - scheduleId: zod.string(), - locationId: zod.string(), -}); - -export const userScheduleGetByLocationResponse = zod.object({ - success: zod.boolean(), - payload: zod - .object({ - _id: zod.string(), - name: zod.string(), - customerId: zod.number(), - slots: zod.array( + refunds: zod.array( zod.object({ - day: zod.enum([ - 'monday', - 'tuesday', - 'wednesday', - 'thursday', - 'friday', - 'saturday', - 'sunday', - ]), - intervals: zod.array( + id: zod.number(), + admin_graphql_api_id: zod.string(), + created_at: zod.string(), + note: zod.string().optional(), + order_id: zod.number(), + processed_at: zod.string(), + restock: zod.boolean(), + total_duties_set: zod + .object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }) + .optional(), + user_id: zod.number(), + refund_line_items: zod.array( zod.object({ - from: zod.string(), - to: zod.string(), + id: zod.number(), + line_item_id: zod.number(), + location_id: zod.number(), + quantity: zod.number(), + restock_type: zod.string(), + subtotal: zod.string().or(zod.number()), + subtotal_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + total_tax: zod.string().or(zod.number()).optional(), + total_tax_set: zod + .object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }) + .optional(), + line_item: zod.object({ + id: zod.number(), + name: zod.string(), + }), }), ), }), ), - locations: zod.array( - zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), + shipping_address: zod + .object({ + customer_id: zod.number().optional(), + first_name: zod.string(), + address1: zod.string().optional(), + phone: zod.string().optional(), + city: zod.string().optional(), + zip: zod.string().optional(), + province: zod.string().optional(), + country: zod.string().optional(), + last_name: zod.string(), + address2: zod.string().optional(), + company: zod.string().optional(), + latitude: zod.number().optional(), + longitude: zod.number().optional(), + name: zod.string(), + country_code: zod.string(), + country_name: zod.string().optional(), + province_code: zod.string().optional(), + default: zod.boolean(), + }) + .optional(), + shipping_lines: zod.array( + zod.object({ + id: zod.number(), + carrier_identifier: zod.string().optional(), + code: zod.string().optional(), + discounted_price: zod.string(), + discounted_price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - ), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + phone: zod.string().optional(), + price: zod.string(), + price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + requested_fulfillment_service_id: zod.string().optional(), + source: zod.string(), + title: zod.string(), + }), ), }) .and( zod.object({ - products: zod.array( - zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ + start: zod.string(), + end: zod.string(), + title: zod.string(), + groupId: zod.string(), + shipping: zod + .object({ + duration: zod.object({ + text: zod.string(), + value: zod.number(), + }), + distance: zod.object({ + text: zod.string(), + value: zod.number(), + }), + }) + .and( + zod.object({ + destination: zod.object({ name: zod.string(), - value: zod.string(), + fullAddress: zod.string(), }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), + cost: zod.object({ + currency: zod.string(), + value: zod.number(), }), - compareAtPrice: zod + }), + ) + .and( + zod.object({ + _id: zod.string(), + location: zod.string(), + origin: zod .object({ - amount: zod.string(), - currencyCode: zod.string(), + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - }) - .and( - zod.object({ - locations: zod.array( - zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), ), - }), - ), - ), - }), - ), -}); - -/** - * This endpoint get all users group by professions - * @summary GET Get all users grouped by professions - */ -export const usersTopResponse = zod.object({ - success: zod.boolean(), - payload: zod.array( - zod.object({ - totalUsers: zod.string(), - profession: zod.string(), - users: zod.array( - zod.object({ + }), + ) + .optional(), + user: zod.object({ customerId: zod.number(), - username: zod.string(), fullname: zod.string(), - aboutMe: zod.string().optional(), + username: zod.string(), shortDescription: zod.string(), - professions: zod.string(), images: zod.object({ profile: zod .object({ @@ -725,764 +637,783 @@ export const usersTopResponse = zod.object({ .optional(), }), }), - ), - }), - ), -}); - -/** - * This endpoint get all users professions - * @summary GET Get all users professions with total count - */ -export const usersProfessionsResponse = zod.object({ - success: zod.boolean(), - payload: zod.record(zod.string(), zod.number()), + location: zod.object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }), + line_items: zod.array( + zod.object({ + id: zod.number(), + admin_graphql_api_id: zod.string(), + fulfillable_quantity: zod.number(), + fulfillment_service: zod.string(), + fulfillment_status: zod.string().optional(), + gift_card: zod.boolean(), + grams: zod.number(), + name: zod.string(), + price: zod.string(), + price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + product_exists: zod.boolean(), + product_id: zod.number(), + properties: zod.object({ + customer_id: zod.number(), + from: zod.string(), + to: zod.string(), + locationId: zod.string(), + groupId: zod.string(), + shippingId: zod.string().optional(), + }), + quantity: zod.number(), + requires_shipping: zod.boolean(), + sku: zod.string().optional(), + taxable: zod.boolean(), + title: zod.string(), + total_discount: zod.string(), + total_discount_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + variant_id: zod.number(), + variant_inventory_management: zod.string().optional(), + variant_title: zod.string().optional(), + vendor: zod.string().optional(), + }), + ), + }), + ), }); /** - * This endpoint get all users specialties - * @summary GET Get all users specialties with total count + * This endpoint get all bookings from orders + * @summary GET Get all bookings for customer from orders */ -export const usersSpecialtiesQueryParams = zod.object({ - profession: zod.string().optional(), -}); - -export const usersSpecialtiesResponse = zod.object({ - success: zod.boolean(), - payload: zod.record(zod.string(), zod.number()), +export const customerBookingRangeParams = zod.object({ + customerId: zod.string(), }); -/** - * This endpoint generate availabilty for user - * @summary POST generate availabilty for user - */ -export const userAvailabilityGenerateBody = zod.object({ - fromDate: zod.string().optional(), - productIds: zod.array(zod.string()), - shippingId: zod.string().optional(), +export const customerBookingRangeQueryParams = zod.object({ + start: zod.string(), + end: zod.string(), }); -export const userAvailabilityGenerateResponse = zod.object({ +export const customerBookingRangeResponse = zod.object({ success: zod.boolean(), payload: zod.array( zod .object({ - date: zod.string(), - customer: zod.object({ - customerId: zod.string(), - fullname: zod.string(), + id: zod.number(), + order_number: zod.number(), + admin_graphql_api_id: zod.string(), + buyer_accepts_marketing: zod.boolean(), + cancel_reason: zod.string().optional(), + cancelled_at: zod.string().optional(), + client_details: zod + .object({ + accept_language: zod.string().optional(), + browser_height: zod.number().optional(), + browser_ip: zod.string().optional(), + browser_width: zod.number().optional(), + session_hash: zod.string().optional(), + user_agent: zod.string().optional(), + }) + .optional(), + closed_at: zod.string().optional(), + confirmed: zod.boolean(), + contact_email: zod.string().optional(), + created_at: zod.string(), + currency: zod.string(), + current_subtotal_price: zod.string(), + current_subtotal_price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), }), - shipping: zod + current_total_additional_fees_set: zod .object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), }) - .and( - zod.object({ - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), - cost: zod.object({ - currency: zod.string(), - value: zod.number(), - }), - }), - ) - .and( - zod.object({ - _id: zod.string(), - location: zod.string(), - origin: zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), - }), - ) .optional(), - }) - .and( - zod.object({ - slots: zod.array( - zod.object({ - from: zod.string(), - to: zod.string(), - products: zod.array( - zod.object({ - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - productId: zod.number(), - variantId: zod.number(), - from: zod.string(), - to: zod.string(), - breakTime: zod.number(), - duration: zod.number(), - }), - ), - }), - ), - }), - ), - ), -}); - -/** - * This endpoint get's one single availabilty for user - * @summary POST get single availabilty for user - */ -export const userAvailabilityGetBody = zod.object({ - fromDate: zod.string(), - toDate: zod.string(), - productIds: zod.array(zod.string()), - shippingId: zod.string().optional(), -}); - -export const userAvailabilityGetResponse = zod.object({ - success: zod.boolean(), - payload: zod - .object({ - date: zod.string(), - customer: zod.object({ - customerId: zod.string(), - fullname: zod.string(), - }), - shipping: zod - .object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), + current_total_discounts: zod.string(), + current_total_discounts_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - }) - .and( - zod.object({ - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), + }), + current_total_duties_set: zod + .object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - cost: zod.object({ - currency: zod.string(), - value: zod.number(), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), + }) + .optional(), + current_total_price: zod.string(), + current_total_price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - ) - .and( - zod.object({ - _id: zod.string(), - location: zod.string(), - origin: zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), }), - ) - .optional(), - }) - .and( - zod.object({ - slot: zod.object({ - from: zod.string(), - to: zod.string(), - products: zod.array( - zod.object({ - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - productId: zod.number(), - variantId: zod.number(), - from: zod.string(), - to: zod.string(), - breakTime: zod.number(), - duration: zod.number(), - }), - ), }), - }), - ), -}); - -/** - * This endpoint get all users - * @summary GET Get all users - */ -export const usersListResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - nextCursor: zod.string().optional(), - results: zod.array( - zod.object({ - customerId: zod.number(), - fullname: zod.string(), - email: zod.string().email(), - phone: zod.string(), - username: zod.string(), - yearsExperience: zod.string(), - professions: zod.array(zod.string()), - specialties: zod.array(zod.string()), - aboutMe: zod.string(), - shortDescription: zod.string(), - gender: zod.string(), - social: zod.object({ - youtube: zod.string().optional(), - x: zod.string().optional(), - instagram: zod.string().optional(), - facebook: zod.string().optional(), + current_total_tax: zod.string(), + current_total_tax_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), }), - speaks: zod.array(zod.string()), - images: zod.object({ - profile: zod + customer: zod.object({ + id: zod.number(), + email: zod.string().optional(), + accepts_marketing: zod.boolean(), + created_at: zod.string(), + updated_at: zod.string(), + first_name: zod.string(), + last_name: zod.string(), + state: zod.string(), + note: zod.string().optional(), + verified_email: zod.boolean(), + multipass_identifier: zod.string().optional(), + tax_exempt: zod.boolean(), + phone: zod.string().optional(), + email_marketing_consent: zod.boolean().optional(), + sms_marketing_consent: zod .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), + state: zod.string().optional(), + opt_in_level: zod.string().optional(), + consent_updated_at: zod.string().optional(), + consent_collected_from: zod.string().optional(), + }) + .optional(), + tags: zod.string(), + currency: zod.string(), + accepts_marketing_updated_at: zod.string().optional(), + marketing_opt_in_level: zod.string().optional(), + tax_exemptions: zod.array(zod.string()).optional(), + admin_graphql_api_id: zod.string(), + default_address: zod + .object({ + customer_id: zod.number().optional(), + first_name: zod.string(), + address1: zod.string().optional(), + phone: zod.string().optional(), + city: zod.string().optional(), + zip: zod.string().optional(), + province: zod.string().optional(), + country: zod.string().optional(), + last_name: zod.string(), + address2: zod.string().optional(), + company: zod.string().optional(), + latitude: zod.number().optional(), + longitude: zod.number().optional(), + name: zod.string(), + country_code: zod.string(), + country_name: zod.string().optional(), + province_code: zod.string().optional(), + default: zod.boolean(), }) .optional(), }), - }), - ), - total: zod.number(), - }), -}); - -/** - * This endpoint gets customer upload resource url, so customer can upload image - * @summary GET Get customer upload resource url - */ -export const customerUploadResourceURLParams = zod.object({ - customerId: zod.string(), -}); - -export const customerUploadResourceURLResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - resourceUrl: zod.string().optional(), - url: zod.string(), - parameters: zod.array( - zod.object({ - name: zod.string(), - value: zod.string(), - }), - ), - }), -}); - -/** - * This endpoint update user - * @summary PUT Update user - */ -export const customerUpdateParams = zod.object({ - customerId: zod.string(), -}); - -export const customerUpdateBody = zod.object({ - fullname: zod.string().optional(), - email: zod.string().email().optional(), - phone: zod.string().optional(), - yearsExperience: zod.string().optional(), - professions: zod.array(zod.string()).optional(), - specialties: zod.array(zod.string()).optional(), - aboutMe: zod.string().optional(), - shortDescription: zod.string().optional(), - gender: zod.string().optional(), - social: zod - .object({ - youtube: zod.string().optional(), - facebook: zod.string().optional(), - instagram: zod.string().optional(), - x: zod.string().optional(), - }) - .optional(), - speaks: zod.array(zod.string()).optional(), -}); - -export const customerUpdateResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - customerId: zod.number(), - fullname: zod.string(), - email: zod.string().email(), - phone: zod.string(), - username: zod.string(), - yearsExperience: zod.string(), - professions: zod.array(zod.string()), - specialties: zod.array(zod.string()), - aboutMe: zod.string(), - shortDescription: zod.string(), - gender: zod.string(), - social: zod.object({ - youtube: zod.string().optional(), - x: zod.string().optional(), - instagram: zod.string().optional(), - facebook: zod.string().optional(), - }), - speaks: zod.array(zod.string()), - images: zod.object({ - profile: zod - .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), - }) - .optional(), - }), - }), -}); - -/** - * This endpoint gets customer object - * @summary GET Get customer - */ -export const customerGetParams = zod.object({ - customerId: zod.string(), -}); - -export const customerGetResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - customerId: zod.number(), - fullname: zod.string(), - email: zod.string().email(), - phone: zod.string(), - username: zod.string(), - yearsExperience: zod.string(), - professions: zod.array(zod.string()), - specialties: zod.array(zod.string()), - aboutMe: zod.string(), - shortDescription: zod.string(), - gender: zod.string(), - social: zod.object({ - youtube: zod.string().optional(), - x: zod.string().optional(), - instagram: zod.string().optional(), - facebook: zod.string().optional(), - }), - speaks: zod.array(zod.string()), - images: zod.object({ - profile: zod - .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), - }) - .optional(), - }), - }), -}); - -/** - * This endpoint gets customer status - * @summary GET Get customer status - */ -export const customerStatusParams = zod.object({ - customerId: zod.string(), -}); - -export const customerStatusResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - profile: zod.boolean(), - locations: zod.boolean(), - schedules: zod.boolean(), - services: zod.boolean(), - profileImage: zod.boolean(), - }), -}); - -/** - * This endpoint creates new user - * @summary PUT Create user - */ -export const customerCreateBodyUsernameRegExp = new RegExp('^[a-zA-Z0-9-_]+$'); - -export const customerCreateBody = zod.object({ - customerId: zod.number(), - fullname: zod.string(), - email: zod.string().email(), - phone: zod.string(), - username: zod.string().regex(customerCreateBodyUsernameRegExp), - yearsExperience: zod.string(), - professions: zod.array(zod.string()), - specialties: zod.array(zod.string()), - aboutMe: zod.string(), - shortDescription: zod.string(), - gender: zod.string(), - social: zod.object({ - youtube: zod.string().optional(), - x: zod.string().optional(), - instagram: zod.string().optional(), - facebook: zod.string().optional(), - }), - speaks: zod.array(zod.string()), -}); - -export const customerCreateResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - customerId: zod.number(), - fullname: zod.string(), - email: zod.string().email(), - phone: zod.string(), - username: zod.string(), - yearsExperience: zod.string(), - professions: zod.array(zod.string()), - specialties: zod.array(zod.string()), - aboutMe: zod.string(), - shortDescription: zod.string(), - gender: zod.string(), - social: zod.object({ - youtube: zod.string().optional(), - x: zod.string().optional(), - instagram: zod.string().optional(), - facebook: zod.string().optional(), - }), - speaks: zod.array(zod.string()), - images: zod.object({ - profile: zod - .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), - }) - .optional(), - }), - }), -}); - -/** - * This endpoint return if customer is business or not - * @summary GET Get customer is business - */ -export const customerIsBusinessParams = zod.object({ - customerId: zod.string(), -}); - -export const customerIsBusinessResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - isBusiness: zod.boolean().optional(), - }), -}); - -/** - * This endpoint get products for customer - * @summary GET Get products for customer - */ -export const customerProductsListResponse = zod.object({ - success: zod.boolean(), - payload: zod.array( - zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod + fulfillments: zod.array( + zod.object({ + id: zod.number(), + admin_graphql_api_id: zod.string(), + created_at: zod.string(), + location_id: zod.number(), + name: zod.string(), + order_id: zod.number(), + service: zod.string(), + shipment_status: zod.string().optional(), + status: zod.string(), + tracking_company: zod.string().optional(), + tracking_number: zod.string().optional(), + tracking_numbers: zod.array(zod.string()).optional(), + tracking_url: zod.string().optional(), + tracking_urls: zod.array(zod.string()).optional(), + updated_at: zod.string().optional(), + line_items: zod.array( + zod.object({ + id: zod.number(), + name: zod.string(), + }), + ), + }), + ), + refunds: zod.array( + zod.object({ + id: zod.number(), + admin_graphql_api_id: zod.string(), + created_at: zod.string(), + note: zod.string().optional(), + order_id: zod.number(), + processed_at: zod.string(), + restock: zod.boolean(), + total_duties_set: zod + .object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }) + .optional(), + user_id: zod.number(), + refund_line_items: zod.array( + zod.object({ + id: zod.number(), + line_item_id: zod.number(), + location_id: zod.number(), + quantity: zod.number(), + restock_type: zod.string(), + subtotal: zod.string().or(zod.number()), + subtotal_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + total_tax: zod.string().or(zod.number()).optional(), + total_tax_set: zod + .object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }) + .optional(), + line_item: zod.object({ + id: zod.number(), + name: zod.string(), + }), + }), + ), + }), + ), + shipping_address: zod .object({ - amount: zod.string(), - currencyCode: zod.string(), + customer_id: zod.number().optional(), + first_name: zod.string(), + address1: zod.string().optional(), + phone: zod.string().optional(), + city: zod.string().optional(), + zip: zod.string().optional(), + province: zod.string().optional(), + country: zod.string().optional(), + last_name: zod.string(), + address2: zod.string().optional(), + company: zod.string().optional(), + latitude: zod.number().optional(), + longitude: zod.number().optional(), + name: zod.string(), + country_code: zod.string(), + country_name: zod.string().optional(), + province_code: zod.string().optional(), + default: zod.boolean(), }) .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), + shipping_lines: zod.array( + zod.object({ + id: zod.number(), + carrier_identifier: zod.string().optional(), + code: zod.string().optional(), + discounted_price: zod.string(), + discounted_price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + phone: zod.string().optional(), + price: zod.string(), + price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + requested_fulfillment_service_id: zod.string().optional(), + source: zod.string(), + title: zod.string(), + }), + ), }) .and( zod.object({ - locations: zod.array( + start: zod.string(), + end: zod.string(), + title: zod.string(), + groupId: zod.string(), + shipping: zod + .object({ + duration: zod.object({ + text: zod.string(), + value: zod.number(), + }), + distance: zod.object({ + text: zod.string(), + value: zod.number(), + }), + }) + .and( + zod.object({ + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), + cost: zod.object({ + currency: zod.string(), + value: zod.number(), + }), + }), + ) + .and( + zod.object({ + _id: zod.string(), + location: zod.string(), + origin: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + }), + ) + .optional(), + user: zod.object({ + customerId: zod.number(), + fullname: zod.string(), + username: zod.string(), + shortDescription: zod.string(), + images: zod.object({ + profile: zod + .object({ + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), + }) + .optional(), + }), + }), + location: zod.object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }), + line_items: zod.array( zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), + id: zod.number(), + admin_graphql_api_id: zod.string(), + fulfillable_quantity: zod.number(), + fulfillment_service: zod.string(), + fulfillment_status: zod.string().optional(), + gift_card: zod.boolean(), + grams: zod.number(), + name: zod.string(), + price: zod.string(), + price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + product_exists: zod.boolean(), + product_id: zod.number(), + properties: zod.object({ + customer_id: zod.number(), + from: zod.string(), + to: zod.string(), + locationId: zod.string(), + groupId: zod.string(), + shippingId: zod.string().optional(), + }), + quantity: zod.number(), + requires_shipping: zod.boolean(), + sku: zod.string().optional(), + taxable: zod.boolean(), + title: zod.string(), + total_discount: zod.string(), + total_discount_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + variant_id: zod.number(), + variant_inventory_management: zod.string().optional(), + variant_title: zod.string().optional(), + vendor: zod.string().optional(), }), ), }), - ) - .and( - zod.object({ - scheduleId: zod.string(), - scheduleName: zod.string(), - }), ), ), }); /** - * This endpoint get product ids for customer - * @summary GET Get product ids for customer + * This endpoint get one location for user + * @summary GET Get one location from user */ -export const customerProductsListIdsResponse = zod.object({ - success: zod.boolean(), - payload: zod.array(zod.number()), +export const customerLocationGetParams = zod.object({ + customerId: zod.string(), + locationId: zod.string(), }); -/** - * This endpoint get product for customer - * @summary GET Get product that exist in one of the schedules for customer - */ -export const customerProductGetResponse = zod.object({ +export const customerLocationGetResponse = zod.object({ success: zod.boolean(), payload: zod .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), }) .and( zod.object({ - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), - }), - ), + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), }), ) .and( zod.object({ - scheduleId: zod.string(), - scheduleName: zod.string(), + isDefault: zod.boolean(), }), ), }); /** - * This endpoint update product that exist in schedule - * @summary PUT Upsert product to schedule + * This endpoint remove location but does not delete location from db + * @summary POST Remove location from user */ -export const customerProductUpsertBody = zod.object({ - scheduleId: zod.string(), - productHandle: zod.string(), - variantId: zod.number(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), - }), - ), +export const customerLocationRemoveParams = zod.object({ + customerId: zod.string(), + locationId: zod.string(), }); -export const customerProductUpsertResponse = zod.object({ +export const customerLocationRemoveResponse = zod.object({ success: zod.boolean(), - payload: zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod + payload: zod.object({ + customerId: zod.number(), + fullname: zod.string(), + email: zod.string().email(), + phone: zod.string(), + username: zod.string(), + yearsExperience: zod.string(), + professions: zod.array(zod.string()), + specialties: zod.array(zod.string()), + aboutMe: zod.string(), + shortDescription: zod.string(), + gender: zod.string(), + social: zod.object({ + youtube: zod.string().optional(), + x: zod.string().optional(), + instagram: zod.string().optional(), + facebook: zod.string().optional(), + }), + speaks: zod.array(zod.string()), + images: zod.object({ + profile: zod .object({ - amount: zod.string(), - currencyCode: zod.string(), + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), }) .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), + }), + }), +}); + +/** + * This endpoint update existing location + * @summary PUT Update location + */ +export const customerLocationUpdateParams = zod.object({ + customerId: zod.string(), + locationId: zod.string(), +}); + +export const customerLocationUpdateBody = zod.object({ + name: zod.string(), + fullAddress: zod.string(), + originType: zod.enum(['home', 'commercial']), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), +}); + +export const customerLocationUpdateResponse = zod.object({ + success: zod.boolean(), + payload: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), }) .and( zod.object({ - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), - }), - ), - }), - ) - .and( - zod.object({ - scheduleId: zod.string(), - scheduleName: zod.string(), + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), }), ), }); /** - * This endpoint remove product from schedule for customer - * @summary DEL destroy product + * This endpoint set new default location for user + * @summary POST Set new default location for user */ -export const customerProductDestroyResponse = zod.object({ +export const customerLocationSetDefaultParams = zod.object({ + customerId: zod.string(), + locationId: zod.string(), +}); + +export const customerLocationSetDefaultResponse = zod.object({ success: zod.boolean(), payload: zod.object({ - matchedCount: zod.number(), - modifiedCount: zod.number(), - upsertedCount: zod.number(), + customerId: zod.number(), + fullname: zod.string(), + email: zod.string().email(), + phone: zod.string(), + username: zod.string(), + yearsExperience: zod.string(), + professions: zod.array(zod.string()), + specialties: zod.array(zod.string()), + aboutMe: zod.string(), + shortDescription: zod.string(), + gender: zod.string(), + social: zod.object({ + youtube: zod.string().optional(), + x: zod.string().optional(), + instagram: zod.string().optional(), + facebook: zod.string().optional(), + }), + speaks: zod.array(zod.string()), + images: zod.object({ + profile: zod + .object({ + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), + }) + .optional(), + }), }), }); /** - * This endpoint create product variant - * @summary POST create product variant + * This endpoint creates new location + * @summary POST Create location origin or destination */ -export const customerProductCreateVariantParams = zod.object({ +export const customerLocationCreateParams = zod.object({ customerId: zod.string(), - productId: zod.string(), }); -export const customerProductCreateVariantBody = zod.object({ - price: zod.number(), - compareAtPrice: zod.number(), +export const customerLocationCreateBody = zod.object({ + name: zod.string(), + fullAddress: zod.string(), + originType: zod.enum(['home', 'commercial']), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + locationType: zod.enum(['origin', 'destination']), }); -export const customerProductCreateVariantResponse = zod.object({ +export const customerLocationCreateResponse = zod.object({ success: zod.boolean(), - payload: zod.object({ - product: zod.object({ - id: zod.number(), - handle: zod.string(), - }), - id: zod.number(), - title: zod.string(), - selectedOptions: zod.array( + payload: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }) + .and( zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), +}); + +/** + * This endpoint get all locations for user + * @summary GET Get all locations for user + */ +export const customerLocationListParams = zod.object({ + customerId: zod.string(), +}); + +export const customerLocationListResponse = zod.object({ + success: zod.boolean(), + payload: zod.array( + zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), name: zod.string(), - value: zod.string(), - }), - ), - price: zod.string(), - compareAtPrice: zod.string(), - }), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ) + .and( + zod.object({ + isDefault: zod.boolean(), + }), + ), + ), }); /** - * This endpoint gets order with lineItems array of objects specific for groupId - * @summary GET Get order with lineItems array for specific groupId + * This endpoint gets order with lineItems array of objects + * @summary GET Get order with lineItems array */ -export const customerBookingGetByGroupParams = zod.object({ +export const customerOrderGetParams = zod.object({ customerId: zod.string(), orderId: zod.string(), - groupId: zod.string(), }); -export const customerBookingGetByGroupResponse = zod.object({ +export const customerOrderGetResponse = zod.object({ success: zod.boolean(), payload: zod .object({ @@ -1684,281 +1615,64 @@ export const customerBookingGetByGroupResponse = zod.object({ subtotal: zod.string().or(zod.number()), subtotal_set: zod.object({ shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - total_tax: zod.string().or(zod.number()).optional(), - total_tax_set: zod - .object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }) - .optional(), - line_item: zod.object({ - id: zod.number(), - name: zod.string(), - }), - }), - ), - }), - ), - shipping_address: zod - .object({ - customer_id: zod.number().optional(), - first_name: zod.string(), - address1: zod.string().optional(), - phone: zod.string().optional(), - city: zod.string().optional(), - zip: zod.string().optional(), - province: zod.string().optional(), - country: zod.string().optional(), - last_name: zod.string(), - address2: zod.string().optional(), - company: zod.string().optional(), - latitude: zod.number().optional(), - longitude: zod.number().optional(), - name: zod.string(), - country_code: zod.string(), - country_name: zod.string().optional(), - province_code: zod.string().optional(), - default: zod.boolean(), - }) - .optional(), - shipping_lines: zod.array( - zod.object({ - id: zod.number(), - carrier_identifier: zod.string().optional(), - code: zod.string().optional(), - discounted_price: zod.string(), - discounted_price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - phone: zod.string().optional(), - price: zod.string(), - price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - requested_fulfillment_service_id: zod.string().optional(), - source: zod.string(), - title: zod.string(), - }), - ), - }) - .and( - zod.object({ - start: zod.string(), - end: zod.string(), - title: zod.string(), - groupId: zod.string(), - shipping: zod - .object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), - }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), - }), - }) - .and( - zod.object({ - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), - cost: zod.object({ - currency: zod.string(), - value: zod.number(), - }), - }), - ) - .and( - zod.object({ - _id: zod.string(), - location: zod.string(), - origin: zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), - }), - ) - .optional(), - user: zod.object({ - customerId: zod.number(), - fullname: zod.string(), - username: zod.string(), - shortDescription: zod.string(), - images: zod.object({ - profile: zod - .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), - }) - .optional(), - }), - }), - location: zod.object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }), - line_items: zod.array( - zod.object({ - id: zod.number(), - admin_graphql_api_id: zod.string(), - fulfillable_quantity: zod.number(), - fulfillment_service: zod.string(), - fulfillment_status: zod.string().optional(), - gift_card: zod.boolean(), - grams: zod.number(), - name: zod.string(), - price: zod.string(), - price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - product_exists: zod.boolean(), - product_id: zod.number(), - properties: zod.object({ - customer_id: zod.number(), - from: zod.string(), - to: zod.string(), - locationId: zod.string(), - groupId: zod.string(), - shippingId: zod.string().optional(), - }), - quantity: zod.number(), - requires_shipping: zod.boolean(), - sku: zod.string().optional(), - taxable: zod.boolean(), - title: zod.string(), - total_discount: zod.string(), - total_discount_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + total_tax: zod.string().or(zod.number()).optional(), + total_tax_set: zod + .object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }) + .optional(), + line_item: zod.object({ + id: zod.number(), + name: zod.string(), }), }), - variant_id: zod.number(), - variant_inventory_management: zod.string().optional(), - variant_title: zod.string().optional(), - vendor: zod.string().optional(), - }), - ), - }), - ), -}); - -/** - * This endpoint get all bookings from orders - * @summary GET Get all bookings for customer from orders - */ -export const customerBookingRangeParams = zod.object({ - customerId: zod.string(), -}); - -export const customerBookingRangeQueryParams = zod.object({ - start: zod.string(), - end: zod.string(), -}); - -export const customerBookingRangeResponse = zod.object({ - success: zod.boolean(), - payload: zod.array( - zod - .object({ - id: zod.number(), - order_number: zod.number(), - admin_graphql_api_id: zod.string(), - buyer_accepts_marketing: zod.boolean(), - cancel_reason: zod.string().optional(), - cancelled_at: zod.string().optional(), - client_details: zod - .object({ - accept_language: zod.string().optional(), - browser_height: zod.number().optional(), - browser_ip: zod.string().optional(), - browser_width: zod.number().optional(), - session_hash: zod.string().optional(), - user_agent: zod.string().optional(), - }) - .optional(), - closed_at: zod.string().optional(), - confirmed: zod.boolean(), - contact_email: zod.string().optional(), - created_at: zod.string(), - currency: zod.string(), - current_subtotal_price: zod.string(), - current_subtotal_price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), + ), }), - current_total_additional_fees_set: zod - .object({ + ), + shipping_address: zod + .object({ + customer_id: zod.number().optional(), + first_name: zod.string(), + address1: zod.string().optional(), + phone: zod.string().optional(), + city: zod.string().optional(), + zip: zod.string().optional(), + province: zod.string().optional(), + country: zod.string().optional(), + last_name: zod.string(), + address2: zod.string().optional(), + company: zod.string().optional(), + latitude: zod.number().optional(), + longitude: zod.number().optional(), + name: zod.string(), + country_code: zod.string(), + country_name: zod.string().optional(), + province_code: zod.string().optional(), + default: zod.boolean(), + }) + .optional(), + shipping_lines: zod.array( + zod.object({ + id: zod.number(), + carrier_identifier: zod.string().optional(), + code: zod.string().optional(), + discounted_price: zod.string(), + discounted_price_set: zod.object({ shop_money: zod.object({ amount: zod.string(), currency_code: zod.string(), @@ -1967,21 +1681,10 @@ export const customerBookingRangeResponse = zod.object({ amount: zod.string(), currency_code: zod.string(), }), - }) - .optional(), - current_total_discounts: zod.string(), - current_total_discounts_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), }), - }), - current_total_duties_set: zod - .object({ + phone: zod.string().optional(), + price: zod.string(), + price_set: zod.object({ shop_money: zod.object({ amount: zod.string(), currency_code: zod.string(), @@ -1990,118 +1693,54 @@ export const customerBookingRangeResponse = zod.object({ amount: zod.string(), currency_code: zod.string(), }), - }) - .optional(), - current_total_price: zod.string(), - current_total_price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - current_total_tax: zod.string(), - current_total_tax_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), }), + requested_fulfillment_service_id: zod.string().optional(), + source: zod.string(), + title: zod.string(), }), - customer: zod.object({ - id: zod.number(), - email: zod.string().optional(), - accepts_marketing: zod.boolean(), - created_at: zod.string(), - updated_at: zod.string(), - first_name: zod.string(), - last_name: zod.string(), - state: zod.string(), - note: zod.string().optional(), - verified_email: zod.boolean(), - multipass_identifier: zod.string().optional(), - tax_exempt: zod.boolean(), - phone: zod.string().optional(), - email_marketing_consent: zod.boolean().optional(), - sms_marketing_consent: zod - .object({ - state: zod.string().optional(), - opt_in_level: zod.string().optional(), - consent_updated_at: zod.string().optional(), - consent_collected_from: zod.string().optional(), - }) - .optional(), - tags: zod.string(), - currency: zod.string(), - accepts_marketing_updated_at: zod.string().optional(), - marketing_opt_in_level: zod.string().optional(), - tax_exemptions: zod.array(zod.string()).optional(), - admin_graphql_api_id: zod.string(), - default_address: zod + ), + }) + .and( + zod.object({ + line_items: zod.array( + zod .object({ - customer_id: zod.number().optional(), - first_name: zod.string(), - address1: zod.string().optional(), - phone: zod.string().optional(), - city: zod.string().optional(), - zip: zod.string().optional(), - province: zod.string().optional(), - country: zod.string().optional(), - last_name: zod.string(), - address2: zod.string().optional(), - company: zod.string().optional(), - latitude: zod.number().optional(), - longitude: zod.number().optional(), + id: zod.number(), + admin_graphql_api_id: zod.string(), + fulfillable_quantity: zod.number(), + fulfillment_service: zod.string(), + fulfillment_status: zod.string().optional(), + gift_card: zod.boolean(), + grams: zod.number(), name: zod.string(), - country_code: zod.string(), - country_name: zod.string().optional(), - province_code: zod.string().optional(), - default: zod.boolean(), - }) - .optional(), - }), - fulfillments: zod.array( - zod.object({ - id: zod.number(), - admin_graphql_api_id: zod.string(), - created_at: zod.string(), - location_id: zod.number(), - name: zod.string(), - order_id: zod.number(), - service: zod.string(), - shipment_status: zod.string().optional(), - status: zod.string(), - tracking_company: zod.string().optional(), - tracking_number: zod.string().optional(), - tracking_numbers: zod.array(zod.string()).optional(), - tracking_url: zod.string().optional(), - tracking_urls: zod.array(zod.string()).optional(), - updated_at: zod.string().optional(), - line_items: zod.array( - zod.object({ - id: zod.number(), - name: zod.string(), + price: zod.string(), + price_set: zod.object({ + shop_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + presentment_money: zod.object({ + amount: zod.string(), + currency_code: zod.string(), + }), + }), + product_exists: zod.boolean(), + product_id: zod.number(), + properties: zod.object({ + customer_id: zod.number(), + from: zod.string(), + to: zod.string(), + locationId: zod.string(), + groupId: zod.string(), + shippingId: zod.string().optional(), }), - ), - }), - ), - refunds: zod.array( - zod.object({ - id: zod.number(), - admin_graphql_api_id: zod.string(), - created_at: zod.string(), - note: zod.string().optional(), - order_id: zod.number(), - processed_at: zod.string(), - restock: zod.boolean(), - total_duties_set: zod - .object({ + quantity: zod.number(), + requires_shipping: zod.boolean(), + sku: zod.string().optional(), + taxable: zod.boolean(), + title: zod.string(), + total_discount: zod.string(), + total_discount_set: zod.object({ shop_money: zod.object({ amount: zod.string(), currency_code: zod.string(), @@ -2110,687 +1749,813 @@ export const customerBookingRangeResponse = zod.object({ amount: zod.string(), currency_code: zod.string(), }), - }) - .optional(), - user_id: zod.number(), - refund_line_items: zod.array( + }), + variant_id: zod.number(), + variant_inventory_management: zod.string().optional(), + variant_title: zod.string().optional(), + vendor: zod.string().optional(), + }) + .and( zod.object({ - id: zod.number(), - line_item_id: zod.number(), - location_id: zod.number(), - quantity: zod.number(), - restock_type: zod.string(), - subtotal: zod.string().or(zod.number()), - subtotal_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + user: zod.object({ + customerId: zod.number(), + fullname: zod.string(), + username: zod.string(), + shortDescription: zod.string(), + images: zod.object({ + profile: zod + .object({ + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), + }) + .optional(), }), }), - total_tax: zod.string().or(zod.number()).optional(), - total_tax_set: zod + location: zod.object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }), + shipping: zod .object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + duration: zod.object({ + text: zod.string(), + value: zod.number(), }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + distance: zod.object({ + text: zod.string(), + value: zod.number(), }), }) + .and( + zod.object({ + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), + cost: zod.object({ + currency: zod.string(), + value: zod.number(), + }), + }), + ) + .and( + zod.object({ + _id: zod.string(), + location: zod.string(), + origin: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + }), + ) .optional(), - line_item: zod.object({ - id: zod.number(), - name: zod.string(), - }), }), ), - }), ), - shipping_address: zod - .object({ - customer_id: zod.number().optional(), - first_name: zod.string(), - address1: zod.string().optional(), - phone: zod.string().optional(), - city: zod.string().optional(), - zip: zod.string().optional(), - province: zod.string().optional(), - country: zod.string().optional(), - last_name: zod.string(), - address2: zod.string().optional(), - company: zod.string().optional(), - latitude: zod.number().optional(), - longitude: zod.number().optional(), - name: zod.string(), - country_code: zod.string(), - country_name: zod.string().optional(), - province_code: zod.string().optional(), - default: zod.boolean(), - }) - .optional(), - shipping_lines: zod.array( + }), + ), +}); + +/** + * This endpoint create new payout account + * @summary POST Create payout account + */ +export const customerPayoutAccountCreateParams = zod.object({ + customerId: zod.string(), +}); + +export const customerPayoutAccountCreateBody = zod.object({ + payoutType: zod.enum(['MOBILE_PAY', 'BANK_ACCOUNT']), + payoutDetails: zod + .object({ + phoneNumber: zod.string().or(zod.number()), + }) + .or( + zod.object({ + bankName: zod.string(), + regNum: zod.number(), + accountNum: zod.number(), + }), + ), +}); + +export const customerPayoutAccountCreateResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + customerId: zod.string().or(zod.number()), + payoutType: zod.enum(['MOBILE_PAY', 'BANK_ACCOUNT']), + payoutDetails: zod + .object({ + phoneNumber: zod.string().or(zod.number()), + }) + .or( + zod.object({ + bankName: zod.string(), + regNum: zod.number(), + accountNum: zod.number(), + }), + ), + }), +}); + +/** + * This endpoint get payout account + * @summary GET get payout account + */ +export const customerPayoutAccountGetParams = zod.object({ + customerId: zod.string(), +}); + +export const customerPayoutAccountGetResponse = zod.object({ + success: zod.boolean(), + payload: zod + .object({ + customerId: zod.string().or(zod.number()), + payoutType: zod.enum(['MOBILE_PAY', 'BANK_ACCOUNT']), + payoutDetails: zod + .object({ + phoneNumber: zod.string().or(zod.number()), + }) + .or( zod.object({ - id: zod.number(), - carrier_identifier: zod.string().optional(), - code: zod.string().optional(), - discounted_price: zod.string(), - discounted_price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - phone: zod.string().optional(), - price: zod.string(), - price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - requested_fulfillment_service_id: zod.string().optional(), - source: zod.string(), - title: zod.string(), + bankName: zod.string(), + regNum: zod.number(), + accountNum: zod.number(), }), ), + }) + .nullable(), +}); + +/** + * This endpoint destroy payout account for customer + * @summary DEL destroy payout account + */ +export const customerPayoutAccountDestroyParams = zod.object({ + customerId: zod.string(), +}); + +export const customerPayoutAccountDestroyResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + deletedCount: zod.number(), + acknowledged: zod.boolean(), + }), +}); + +/** + * This endpoint get products for customer + * @summary GET Get products for customer + */ +export const customerProductsListResponse = zod.object({ + success: zod.boolean(), + payload: zod.array( + zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), }) .and( zod.object({ - start: zod.string(), - end: zod.string(), - title: zod.string(), - groupId: zod.string(), - shipping: zod - .object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), - }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), - }), - }) - .and( - zod.object({ - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), - cost: zod.object({ - currency: zod.string(), - value: zod.number(), - }), - }), - ) - .and( - zod.object({ - _id: zod.string(), - location: zod.string(), - origin: zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), - }), - ) - .optional(), - user: zod.object({ - customerId: zod.number(), - fullname: zod.string(), - username: zod.string(), - shortDescription: zod.string(), - images: zod.object({ - profile: zod - .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), - }) - .optional(), - }), - }), - location: zod.object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }), - line_items: zod.array( + locations: zod.array( zod.object({ - id: zod.number(), - admin_graphql_api_id: zod.string(), - fulfillable_quantity: zod.number(), - fulfillment_service: zod.string(), - fulfillment_status: zod.string().optional(), - gift_card: zod.boolean(), - grams: zod.number(), - name: zod.string(), - price: zod.string(), - price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - product_exists: zod.boolean(), - product_id: zod.number(), - properties: zod.object({ - customer_id: zod.number(), - from: zod.string(), - to: zod.string(), - locationId: zod.string(), - groupId: zod.string(), - shippingId: zod.string().optional(), - }), - quantity: zod.number(), - requires_shipping: zod.boolean(), - sku: zod.string().optional(), - taxable: zod.boolean(), - title: zod.string(), - total_discount: zod.string(), - total_discount_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - variant_id: zod.number(), - variant_inventory_management: zod.string().optional(), - variant_title: zod.string().optional(), - vendor: zod.string().optional(), + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), }), ), }), + ) + .and( + zod.object({ + scheduleId: zod.string(), + scheduleName: zod.string(), + }), ), ), }); /** - * This endpoint gets order with lineItems array of objects - * @summary GET Get order with lineItems array + * This endpoint get product ids for customer + * @summary GET Get product ids for customer */ -export const customerOrderGetParams = zod.object({ - customerId: zod.string(), - orderId: zod.string(), +export const customerProductsListIdsResponse = zod.object({ + success: zod.boolean(), + payload: zod.array(zod.number()), +}); + +/** + * This endpoint get product for customer + * @summary GET Get product that exist in one of the schedules for customer + */ +export const customerProductGetResponse = zod.object({ + success: zod.boolean(), + payload: zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + }) + .and( + zod.object({ + locations: zod.array( + zod.object({ + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), + }), + ), + }), + ) + .and( + zod.object({ + scheduleId: zod.string(), + scheduleName: zod.string(), + }), + ), +}); + +/** + * This endpoint update product that exist in schedule + * @summary PUT Upsert product to schedule + */ +export const customerProductUpsertBody = zod.object({ + scheduleId: zod.string(), + productHandle: zod.string(), + variantId: zod.number(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + locations: zod.array( + zod.object({ + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), + }), + ), }); -export const customerOrderGetResponse = zod.object({ +export const customerProductUpsertResponse = zod.object({ success: zod.boolean(), payload: zod .object({ - id: zod.number(), - order_number: zod.number(), - admin_graphql_api_id: zod.string(), - buyer_accepts_marketing: zod.boolean(), - cancel_reason: zod.string().optional(), - cancelled_at: zod.string().optional(), - client_details: zod - .object({ - accept_language: zod.string().optional(), - browser_height: zod.number().optional(), - browser_ip: zod.string().optional(), - browser_width: zod.number().optional(), - session_hash: zod.string().optional(), - user_agent: zod.string().optional(), - }) - .optional(), - closed_at: zod.string().optional(), - confirmed: zod.boolean(), - contact_email: zod.string().optional(), - created_at: zod.string(), - currency: zod.string(), - current_subtotal_price: zod.string(), - current_subtotal_price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), }), - current_total_additional_fees_set: zod + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod .object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), + amount: zod.string(), + currencyCode: zod.string(), }) .optional(), - current_total_discounts: zod.string(), - current_total_discounts_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), }), - current_total_duties_set: zod - .object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + }) + .and( + zod.object({ + locations: zod.array( + zod.object({ + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), }), - }) - .optional(), - current_total_price: zod.string(), - current_total_price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), + ), }), - current_total_tax: zod.string(), - current_total_tax_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), + ) + .and( + zod.object({ + scheduleId: zod.string(), + scheduleName: zod.string(), }), - customer: zod.object({ - id: zod.number(), - email: zod.string().optional(), - accepts_marketing: zod.boolean(), - created_at: zod.string(), - updated_at: zod.string(), - first_name: zod.string(), - last_name: zod.string(), - state: zod.string(), - note: zod.string().optional(), - verified_email: zod.boolean(), - multipass_identifier: zod.string().optional(), - tax_exempt: zod.boolean(), - phone: zod.string().optional(), - email_marketing_consent: zod.boolean().optional(), - sms_marketing_consent: zod - .object({ - state: zod.string().optional(), - opt_in_level: zod.string().optional(), - consent_updated_at: zod.string().optional(), - consent_collected_from: zod.string().optional(), - }) - .optional(), - tags: zod.string(), - currency: zod.string(), - accepts_marketing_updated_at: zod.string().optional(), - marketing_opt_in_level: zod.string().optional(), - tax_exemptions: zod.array(zod.string()).optional(), - admin_graphql_api_id: zod.string(), - default_address: zod - .object({ - customer_id: zod.number().optional(), - first_name: zod.string(), - address1: zod.string().optional(), - phone: zod.string().optional(), - city: zod.string().optional(), - zip: zod.string().optional(), - province: zod.string().optional(), - country: zod.string().optional(), - last_name: zod.string(), - address2: zod.string().optional(), - company: zod.string().optional(), - latitude: zod.number().optional(), - longitude: zod.number().optional(), - name: zod.string(), - country_code: zod.string(), - country_name: zod.string().optional(), - province_code: zod.string().optional(), - default: zod.boolean(), - }) - .optional(), + ), +}); + +/** + * This endpoint remove product from schedule for customer + * @summary DEL destroy product + */ +export const customerProductDestroyResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + matchedCount: zod.number(), + modifiedCount: zod.number(), + upsertedCount: zod.number(), + }), +}); + +/** + * This endpoint create product variant + * @summary POST create product variant + */ +export const customerProductCreateVariantParams = zod.object({ + customerId: zod.string(), + productId: zod.string(), +}); + +export const customerProductCreateVariantBody = zod.object({ + price: zod.number(), + compareAtPrice: zod.number(), +}); + +export const customerProductCreateVariantResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + product: zod.object({ + id: zod.number(), + handle: zod.string(), + }), + id: zod.number(), + title: zod.string(), + selectedOptions: zod.array( + zod.object({ + name: zod.string(), + value: zod.string(), + }), + ), + price: zod.string(), + compareAtPrice: zod.string(), + }), +}); + +/** + * This endpoint gets customer upload resource url, so customer can upload image + * @summary GET Get customer upload resource url + */ +export const customerUploadResourceURLParams = zod.object({ + customerId: zod.string(), +}); + +export const customerUploadResourceURLResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + resourceUrl: zod.string().optional(), + url: zod.string(), + parameters: zod.array( + zod.object({ + name: zod.string(), + value: zod.string(), + }), + ), + }), +}); + +/** + * This endpoint create new schedule + * @summary POST Create schedule + */ +export const customerScheduleCreateBody = zod.object({ + name: zod.string(), +}); + +export const customerScheduleCreateResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + _id: zod.string(), + name: zod.string(), + customerId: zod.number(), + slots: zod.array( + zod.object({ + day: zod.enum([ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]), + intervals: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), + }), + ), }), - fulfillments: zod.array( - zod.object({ - id: zod.number(), - admin_graphql_api_id: zod.string(), - created_at: zod.string(), - location_id: zod.number(), - name: zod.string(), - order_id: zod.number(), - service: zod.string(), - shipment_status: zod.string().optional(), - status: zod.string(), - tracking_company: zod.string().optional(), - tracking_number: zod.string().optional(), - tracking_numbers: zod.array(zod.string()).optional(), - tracking_url: zod.string().optional(), - tracking_urls: zod.array(zod.string()).optional(), - updated_at: zod.string().optional(), - line_items: zod.array( - zod.object({ - id: zod.number(), - name: zod.string(), - }), - ), - }), - ), - refunds: zod.array( - zod.object({ - id: zod.number(), - admin_graphql_api_id: zod.string(), - created_at: zod.string(), - note: zod.string().optional(), - order_id: zod.number(), - processed_at: zod.string(), - restock: zod.boolean(), - total_duties_set: zod + ), + products: zod.array( + zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod .object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), + amount: zod.string(), + currencyCode: zod.string(), }) .optional(), - user_id: zod.number(), - refund_line_items: zod.array( - zod.object({ - id: zod.number(), - line_item_id: zod.number(), - location_id: zod.number(), - quantity: zod.number(), - restock_type: zod.string(), - subtotal: zod.string().or(zod.number()), - subtotal_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - total_tax: zod.string().or(zod.number()).optional(), - total_tax_set: zod - .object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }) - .optional(), - line_item: zod.object({ - id: zod.number(), - name: zod.string(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + }) + .and( + zod.object({ + locations: zod.array( + zod.object({ + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), }), + ), + }), + ), + ), + }), +}); + +/** + * This endpoint get all schedule for customer + * @summary GET Get all schedule for customer + */ +export const customerScheduleListResponse = zod.object({ + success: zod.boolean(), + payload: zod.array( + zod.object({ + _id: zod.string(), + name: zod.string(), + customerId: zod.number(), + slots: zod.array( + zod.object({ + day: zod.enum([ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]), + intervals: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), }), ), }), ), - shipping_address: zod - .object({ - customer_id: zod.number().optional(), - first_name: zod.string(), - address1: zod.string().optional(), - phone: zod.string().optional(), - city: zod.string().optional(), - zip: zod.string().optional(), - province: zod.string().optional(), - country: zod.string().optional(), - last_name: zod.string(), - address2: zod.string().optional(), - company: zod.string().optional(), - latitude: zod.number().optional(), - longitude: zod.number().optional(), - name: zod.string(), - country_code: zod.string(), - country_name: zod.string().optional(), - province_code: zod.string().optional(), - default: zod.boolean(), - }) - .optional(), - shipping_lines: zod.array( - zod.object({ - id: zod.number(), - carrier_identifier: zod.string().optional(), - code: zod.string().optional(), - discounted_price: zod.string(), - discounted_price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + products: zod.array( + zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), }), - presentment_money: zod.object({ + price: zod.object({ amount: zod.string(), - currency_code: zod.string(), + currencyCode: zod.string(), }), - }), - phone: zod.string().optional(), - price: zod.string(), - price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), }), - }), - requested_fulfillment_service_id: zod.string().optional(), - source: zod.string(), - title: zod.string(), - }), + }) + .and( + zod.object({ + locations: zod.array( + zod.object({ + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), + }), + ), + }), + ), ), - }) - .and( + }), + ), +}); + +/** + * This endpoint get schedule for customer + * @summary GET Get schedule for customer + */ +export const customerScheduleGetResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + _id: zod.string(), + name: zod.string(), + customerId: zod.number(), + slots: zod.array( zod.object({ - line_items: zod.array( - zod + day: zod.enum([ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]), + intervals: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), + }), + ), + }), + ), + products: zod.array( + zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod .object({ - id: zod.number(), - admin_graphql_api_id: zod.string(), - fulfillable_quantity: zod.number(), - fulfillment_service: zod.string(), - fulfillment_status: zod.string().optional(), - gift_card: zod.boolean(), - grams: zod.number(), - name: zod.string(), - price: zod.string(), - price_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - product_exists: zod.boolean(), - product_id: zod.number(), - properties: zod.object({ - customer_id: zod.number(), - from: zod.string(), - to: zod.string(), - locationId: zod.string(), - groupId: zod.string(), - shippingId: zod.string().optional(), - }), - quantity: zod.number(), - requires_shipping: zod.boolean(), - sku: zod.string().optional(), - taxable: zod.boolean(), - title: zod.string(), - total_discount: zod.string(), - total_discount_set: zod.object({ - shop_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - presentment_money: zod.object({ - amount: zod.string(), - currency_code: zod.string(), - }), - }), - variant_id: zod.number(), - variant_inventory_management: zod.string().optional(), - variant_title: zod.string().optional(), - vendor: zod.string().optional(), + amount: zod.string(), + currencyCode: zod.string(), }) - .and( + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + }) + .and( + zod.object({ + locations: zod.array( zod.object({ - user: zod.object({ - customerId: zod.number(), - fullname: zod.string(), - username: zod.string(), - shortDescription: zod.string(), - images: zod.object({ - profile: zod - .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), - }) - .optional(), - }), - }), - location: zod.object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }), - shipping: zod - .object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), - }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), - }), - }) - .and( - zod.object({ - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), - cost: zod.object({ - currency: zod.string(), - value: zod.number(), - }), - }), - ) - .and( - zod.object({ - _id: zod.string(), - location: zod.string(), - origin: zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), - }), - ) - .optional(), + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), + }), + ), + }), + ), + ), + }), +}); + +/** + * This endpoint update schedule + * @summary PUT Update schedule + */ +export const customerScheduleUpdateBody = zod.object({ + name: zod.string(), +}); + +export const customerScheduleUpdateResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + _id: zod.string(), + name: zod.string(), + customerId: zod.number(), + slots: zod.array( + zod.object({ + day: zod.enum([ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]), + intervals: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), + }), + ), + }), + ), + products: zod.array( + zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + }) + .and( + zod.object({ + locations: zod.array( + zod.object({ + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), }), ), + }), ), - }), ), + }), }); /** - * This endpoint create new schedule - * @summary POST Create schedule + * This endpoint destroy schedule for customer + * @summary DEL destroy schedule */ -export const customerScheduleCreateBody = zod.object({ - name: zod.string(), +export const customerScheduleDestroyResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + deletedCount: zod.number(), + acknowledged: zod.boolean(), + }), }); -export const customerScheduleCreateResponse = zod.object({ +/** + * This endpoint update schedule slot + * @summary PUT Update schedule slot + */ +export const customerScheduleSlotUpdateBody = zod.object({ + slots: zod.array( + zod.object({ + day: zod.enum([ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]), + intervals: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), + }), + ), + }), + ), +}); + +export const customerScheduleSlotUpdateResponse = zod.object({ success: zod.boolean(), payload: zod.object({ _id: zod.string(), @@ -2862,425 +2627,600 @@ export const customerScheduleCreateResponse = zod.object({ }); /** - * This endpoint get all schedule for customer - * @summary GET Get all schedule for customer + * This endpoint gets customer status + * @summary GET Get customer status */ -export const customerScheduleListResponse = zod.object({ +export const customerStatusParams = zod.object({ + customerId: zod.string(), +}); + +export const customerStatusResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + profile: zod.boolean(), + locations: zod.boolean(), + schedules: zod.boolean(), + services: zod.boolean(), + profileImage: zod.boolean(), + }), +}); + +/** + * This endpoint return if customer is business or not + * @summary GET Get customer is business + */ +export const customerIsBusinessParams = zod.object({ + customerId: zod.string(), +}); + +export const customerIsBusinessResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + isBusiness: zod.boolean().optional(), + }), +}); + +/** + * This endpoint get coordinates object + * @summary GET location coordinates + */ +export const locationGetCoordinatesQueryParams = zod.object({ + fullAddress: zod.string().optional(), +}); + +export const locationGetCoordinatesResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + longitude: zod.number(), + latitude: zod.number(), + fullAddress: zod.string(), + }), +}); + +/** + * This endpoint gets traval time object + * @summary GET location travel time + */ +export const locationGetTravelTimeQueryParams = zod.object({ + origin: zod.string().optional(), + destination: zod.string().optional(), +}); + +export const locationGetTravelTimeResponse = zod.object({ + success: zod.boolean(), + payload: zod.object({ + duration: zod.object({ + text: zod.string(), + value: zod.number(), + }), + distance: zod.object({ + text: zod.string(), + value: zod.number(), + }), + }), +}); + +/** + * This endpoint get all professions + * @summary GET Get all professions + */ +export const metaProfessionsResponse = zod.object({ success: zod.boolean(), payload: zod.array( zod.object({ - _id: zod.string(), - name: zod.string(), - customerId: zod.number(), - slots: zod.array( - zod.object({ - day: zod.enum([ - 'monday', - 'tuesday', - 'wednesday', - 'thursday', - 'friday', - 'saturday', - 'sunday', - ]), - intervals: zod.array( - zod.object({ - from: zod.string(), - to: zod.string(), - }), - ), - }), - ), - products: zod.array( - zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - }) - .and( - zod.object({ - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), - }), - ), - }), - ), + label: zod.string(), + value: zod.string(), + }), + ), +}); + +/** + * This endpoint get all specialties + * @summary GET Get all specialties + */ +export const metaspecialtiesResponse = zod.object({ + success: zod.boolean(), + payload: zod.array( + zod.object({ + label: zod.string(), + value: zod.string(), + }), + ), +}); + +/** + * This endpoint is used to upload new image for customer + * @summary POST Upload new customer image + */ +export const uploadBody = zod.object({ + customerId: zod.number().or(zod.string()), + resourceUrl: zod.string(), +}); + +export const uploadResponse = zod.object({ + id: zod.string(), + statusQueryGetUri: zod.string(), + sendEventPostUri: zod.string(), + terminatePostUri: zod.string(), + rewindPostUri: zod.string(), + purgeHistoryDeleteUri: zod.string(), + restartPostUri: zod.string(), + suspendPostUri: zod.string(), + resumePostUri: zod.string(), +}); + +/** + * This endpoint respond with users images + * @summary POST get users belongs to productIds array + */ +export const productsGetUsersImageBody = zod.object({ + productIds: zod.array(zod.string()), +}); + +export const productsGetUsersImageResponse = zod.object({ + success: zod.boolean(), + payload: zod.array( + zod.object({ + productId: zod.number(), + totalUsers: zod.number(), + users: zod.array( + zod.object({ + customerId: zod.number(), + username: zod.string(), + images: zod.object({ + profile: zod + .object({ + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), + }) + .optional(), + }), + fullname: zod.string(), + }), ), }), ), }); /** - * This endpoint get schedule for customer - * @summary GET Get schedule for customer + * This endpoint get all users for specific productId and variantId + * @summary GET Get all users for specific productId and variantId */ -export const customerScheduleGetResponse = zod.object({ +export const productsGetUsersByVariantResponse = zod.object({ success: zod.boolean(), payload: zod.object({ - _id: zod.string(), - name: zod.string(), - customerId: zod.number(), - slots: zod.array( + productId: zod.number(), + totalUsers: zod.number(), + nextCursor: zod.string().optional(), + result: zod.array( zod.object({ - day: zod.enum([ - 'monday', - 'tuesday', - 'wednesday', - 'thursday', - 'friday', - 'saturday', - 'sunday', - ]), - intervals: zod.array( - zod.object({ - from: zod.string(), - to: zod.string(), + customerId: zod.number(), + username: zod.string(), + shortDescription: zod.string(), + images: zod.object({ + profile: zod.object({ + url: zod.string().url(), + width: zod.number(), + height: zod.number(), }), - ), + }), + fullname: zod.string(), + variantId: zod.number(), }), ), - products: zod.array( - zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ - name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - }) - .and( - zod.object({ - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), - }), - ), - }), - ), - ), }), }); /** - * This endpoint update schedule - * @summary PUT Update schedule + * @summary POST create shipping */ -export const customerScheduleUpdateBody = zod.object({ - name: zod.string(), +export const shippingCreateBody = zod.object({ + customerId: zod.number().optional(), + locationId: zod.string(), + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), }); -export const customerScheduleUpdateResponse = zod.object({ +export const shippingCreateResponse = zod.object({ success: zod.boolean(), - payload: zod.object({ - _id: zod.string(), - name: zod.string(), - customerId: zod.number(), - slots: zod.array( + payload: zod + .object({ + duration: zod.object({ + text: zod.string(), + value: zod.number(), + }), + distance: zod.object({ + text: zod.string(), + value: zod.number(), + }), + }) + .and( zod.object({ - day: zod.enum([ - 'monday', - 'tuesday', - 'wednesday', - 'thursday', - 'friday', - 'saturday', - 'sunday', - ]), - intervals: zod.array( - zod.object({ - from: zod.string(), - to: zod.string(), - }), - ), + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), + cost: zod.object({ + currency: zod.string(), + value: zod.number(), + }), }), - ), - products: zod.array( - zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ + ) + .and( + zod.object({ + _id: zod.string(), + location: zod.string(), + origin: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - }) - .and( - zod.object({ - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + }), + ), +}); + +/** + * @summary POST get shipping calculate + */ +export const shippingCalculateBody = zod.object({ + customerId: zod.number().optional(), + locationId: zod.string(), + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), +}); + +export const shippingCalculateResponse = zod.object({ + success: zod.boolean(), + payload: zod + .object({ + duration: zod.object({ + text: zod.string(), + value: zod.number(), + }), + distance: zod.object({ + text: zod.string(), + value: zod.number(), + }), + }) + .and( + zod.object({ + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), + cost: zod.object({ + currency: zod.string(), + value: zod.number(), + }), + }), + ) + .and( + zod.object({ + _id: zod.string(), + location: zod.string(), + origin: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), }), - ), - }), - ), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + }), ), - }), -}); - -/** - * This endpoint destroy schedule for customer - * @summary DEL destroy schedule - */ -export const customerScheduleDestroyResponse = zod.object({ - success: zod.boolean(), - payload: zod.object({ - deletedCount: zod.number(), - acknowledged: zod.boolean(), - }), }); /** - * This endpoint update schedule slot - * @summary PUT Update schedule slot + * This endpoint gets shipping object + * @summary GET Get shipping */ -export const customerScheduleSlotUpdateBody = zod.object({ - slots: zod.array( - zod.object({ - day: zod.enum([ - 'monday', - 'tuesday', - 'wednesday', - 'thursday', - 'friday', - 'saturday', - 'sunday', - ]), - intervals: zod.array( - zod.object({ - from: zod.string(), - to: zod.string(), - }), - ), - }), - ), +export const shippingGetParams = zod.object({ + shippingId: zod.string(), }); -export const customerScheduleSlotUpdateResponse = zod.object({ +export const shippingGetResponse = zod.object({ success: zod.boolean(), - payload: zod.object({ - _id: zod.string(), - name: zod.string(), - customerId: zod.number(), - slots: zod.array( + payload: zod + .object({ + duration: zod.object({ + text: zod.string(), + value: zod.number(), + }), + distance: zod.object({ + text: zod.string(), + value: zod.number(), + }), + }) + .and( zod.object({ - day: zod.enum([ - 'monday', - 'tuesday', - 'wednesday', - 'thursday', - 'friday', - 'saturday', - 'sunday', - ]), - intervals: zod.array( - zod.object({ - from: zod.string(), - to: zod.string(), - }), - ), + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), + cost: zod.object({ + currency: zod.string(), + value: zod.number(), + }), }), - ), - products: zod.array( - zod - .object({ - productHandle: zod.string().optional(), - productId: zod.number(), - variantId: zod.number(), - description: zod.string().optional(), - selectedOptions: zod.object({ + ) + .and( + zod.object({ + _id: zod.string(), + location: zod.string(), + origin: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), name: zod.string(), - value: zod.string(), - }), - price: zod.object({ - amount: zod.string(), - currencyCode: zod.string(), - }), - compareAtPrice: zod - .object({ - amount: zod.string(), - currencyCode: zod.string(), - }) - .optional(), - duration: zod.number(), - breakTime: zod.number(), - noticePeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['hours', 'days', 'weeks']), - }), - bookingPeriod: zod.object({ - value: zod.number(), - unit: zod.enum(['weeks', 'months']), - }), - }) - .and( - zod.object({ - locations: zod.array( - zod.object({ - location: zod.string(), - locationType: zod.enum(['origin', 'destination']), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), }), - ), - }), - ), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + }), ), - }), }); /** - * This endpoint get all professions - * @summary GET Get all professions + * This endpoint generate availabilty for user + * @summary POST generate availabilty for user */ -export const metaProfessionsResponse = zod.object({ - success: zod.boolean(), - payload: zod.array( - zod.object({ - label: zod.string(), - value: zod.string(), - }), - ), +export const userAvailabilityGenerateBody = zod.object({ + fromDate: zod.string().optional(), + productIds: zod.array(zod.string()), + shippingId: zod.string().optional(), }); -/** - * This endpoint get all specialties - * @summary GET Get all specialties - */ -export const metaspecialtiesResponse = zod.object({ +export const userAvailabilityGenerateResponse = zod.object({ success: zod.boolean(), payload: zod.array( - zod.object({ - label: zod.string(), - value: zod.string(), - }), + zod + .object({ + date: zod.string(), + customer: zod.object({ + customerId: zod.string(), + fullname: zod.string(), + }), + shipping: zod + .object({ + duration: zod.object({ + text: zod.string(), + value: zod.number(), + }), + distance: zod.object({ + text: zod.string(), + value: zod.number(), + }), + }) + .and( + zod.object({ + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), + cost: zod.object({ + currency: zod.string(), + value: zod.number(), + }), + }), + ) + .and( + zod.object({ + _id: zod.string(), + location: zod.string(), + origin: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + }), + ) + .optional(), + }) + .and( + zod.object({ + slots: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), + products: zod.array( + zod.object({ + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + productId: zod.number(), + variantId: zod.number(), + from: zod.string(), + to: zod.string(), + breakTime: zod.number(), + duration: zod.number(), + }), + ), + }), + ), + }), + ), ), }); /** - * This endpoint set new default location for user - * @summary POST Set new default location for user + * This endpoint get's one single availabilty for user + * @summary POST get single availabilty for user */ -export const customerLocationSetDefaultParams = zod.object({ - customerId: zod.string(), - locationId: zod.string(), +export const userAvailabilityGetBody = zod.object({ + fromDate: zod.string(), + toDate: zod.string(), + productIds: zod.array(zod.string()), + shippingId: zod.string().optional(), }); -export const customerLocationSetDefaultResponse = zod.object({ +export const userAvailabilityGetResponse = zod.object({ success: zod.boolean(), - payload: zod.object({ - customerId: zod.number(), - fullname: zod.string(), - email: zod.string().email(), - phone: zod.string(), - username: zod.string(), - yearsExperience: zod.string(), - professions: zod.array(zod.string()), - specialties: zod.array(zod.string()), - aboutMe: zod.string(), - shortDescription: zod.string(), - gender: zod.string(), - social: zod.object({ - youtube: zod.string().optional(), - x: zod.string().optional(), - instagram: zod.string().optional(), - facebook: zod.string().optional(), - }), - speaks: zod.array(zod.string()), - images: zod.object({ - profile: zod + payload: zod + .object({ + date: zod.string(), + customer: zod.object({ + customerId: zod.string(), + fullname: zod.string(), + }), + shipping: zod .object({ - url: zod.string().url().optional(), - width: zod.number().optional(), - height: zod.number().optional(), + duration: zod.object({ + text: zod.string(), + value: zod.number(), + }), + distance: zod.object({ + text: zod.string(), + value: zod.number(), + }), }) + .and( + zod.object({ + destination: zod.object({ + name: zod.string(), + fullAddress: zod.string(), + }), + cost: zod.object({ + currency: zod.string(), + value: zod.number(), + }), + }), + ) + .and( + zod.object({ + _id: zod.string(), + location: zod.string(), + origin: zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + }), + ) .optional(), - }), - }), + }) + .and( + zod.object({ + slot: zod.object({ + from: zod.string(), + to: zod.string(), + products: zod.array( + zod.object({ + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + productId: zod.number(), + variantId: zod.number(), + from: zod.string(), + to: zod.string(), + breakTime: zod.number(), + duration: zod.number(), + }), + ), + }), + }), + ), }); /** * This endpoint get one location for user * @summary GET Get one location from user */ -export const customerLocationGetParams = zod.object({ - customerId: zod.string(), +export const userLocationGetParams = zod.object({ + username: zod.string(), locationId: zod.string(), }); -export const customerLocationGetResponse = zod.object({ +export const userLocationGetResponse = zod.object({ success: zod.boolean(), payload: zod .object({ @@ -3304,24 +3244,14 @@ export const customerLocationGetResponse = zod.object({ maxDriveDistance: zod.number(), startFee: zod.number(), }), - ) - .and( - zod.object({ - isDefault: zod.boolean(), - }), ), }); /** - * This endpoint remove location but does not delete location from db - * @summary POST Remove location from user + * This endpoint gets user object + * @summary GET Get user */ -export const customerLocationRemoveParams = zod.object({ - customerId: zod.string(), - locationId: zod.string(), -}); - -export const customerLocationRemoveResponse = zod.object({ +export const userGetResponse = zod.object({ success: zod.boolean(), payload: zod.object({ customerId: zod.number(), @@ -3348,232 +3278,284 @@ export const customerLocationRemoveResponse = zod.object({ url: zod.string().url().optional(), width: zod.number().optional(), height: zod.number().optional(), - }) - .optional(), - }), - }), -}); - -/** - * This endpoint update existing location - * @summary PUT Update location - */ -export const customerLocationUpdateParams = zod.object({ - customerId: zod.string(), - locationId: zod.string(), -}); - -export const customerLocationUpdateBody = zod.object({ - name: zod.string(), - fullAddress: zod.string(), - originType: zod.enum(['home', 'commercial']), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), -}); - -export const customerLocationUpdateResponse = zod.object({ - success: zod.boolean(), - payload: zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), -}); - -/** - * This endpoint creates new location - * @summary POST Create location origin or destination - */ -export const customerLocationCreateParams = zod.object({ - customerId: zod.string(), -}); - -export const customerLocationCreateBody = zod.object({ - name: zod.string(), - fullAddress: zod.string(), - originType: zod.enum(['home', 'commercial']), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - locationType: zod.enum(['origin', 'destination']), + }) + .optional(), + }), + }), }); -export const customerLocationCreateResponse = zod.object({ +/** + * This endpoint return false or true + * @summary GET check if username is taken + */ +export const userUsernameTakenParams = zod.object({ + username: zod.string(), +}); + +export const userUsernameTakenResponse = zod.object({ success: zod.boolean(), - payload: zod - .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), - }) - .and( - zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), + payload: zod.object({ + usernameTaken: zod.boolean(), + }), }); /** - * This endpoint get all locations for user - * @summary GET Get all locations for user + * This endpoint get products for user (across all schedules or one scheduleId) + * @summary GET Get products for user */ -export const customerLocationListParams = zod.object({ - customerId: zod.string(), +export const userProductsListByScheduleParams = zod.object({ + username: zod.string(), }); -export const customerLocationListResponse = zod.object({ +export const userProductsListByScheduleQueryParams = zod.object({ + scheduleId: zod.string().optional(), +}); + +export const userProductsListByScheduleResponse = zod.object({ success: zod.boolean(), payload: zod.array( zod .object({ - locationType: zod.enum(['origin', 'destination']), - customerId: zod.string(), - originType: zod.enum(['home', 'commercial']), - name: zod.string(), - fullAddress: zod.string(), + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), }) .and( zod.object({ - _id: zod.string(), - geoLocation: zod.object({ - type: zod.enum(['Point']), - coordinates: zod.array(zod.number()), - }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), + locations: zod.array( + zod.object({ + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), + }), + ), }), ) .and( zod.object({ - isDefault: zod.boolean(), + scheduleId: zod.string(), + scheduleName: zod.string(), }), ), ), }); /** - * This endpoint get coordinates object - * @summary GET location coordinates + * This endpoint get product for customer + * @summary GET Get product that exist in one of the schedules for customer */ -export const locationGetCoordinatesQueryParams = zod.object({ - fullAddress: zod.string().optional(), +export const userProductGetParams = zod.object({ + username: zod.string(), + productHandle: zod.string(), }); -export const locationGetCoordinatesResponse = zod.object({ +export const userProductGetResponse = zod.object({ success: zod.boolean(), - payload: zod.object({ - longitude: zod.number(), - latitude: zod.number(), - fullAddress: zod.string(), - }), + payload: zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + }) + .and( + zod.object({ + locations: zod.array( + zod.object({ + location: zod.string(), + locationType: zod.enum(['origin', 'destination']), + }), + ), + }), + ) + .and( + zod.object({ + scheduleId: zod.string(), + scheduleName: zod.string(), + }), + ), }); /** - * This endpoint gets traval time object - * @summary GET location travel time + * This endpoint get products from one schedule by location + * @summary GET Get products for user */ -export const locationGetTravelTimeQueryParams = zod.object({ - origin: zod.string().optional(), - destination: zod.string().optional(), +export const userProductsGetProductsParams = zod.object({ + username: zod.string(), + locationId: zod.string(), }); -export const locationGetTravelTimeResponse = zod.object({ +export const userProductsGetProductsBody = zod.object({ + productHandlers: zod.array(zod.string()), +}); + +export const userProductsGetProductsResponse = zod.object({ success: zod.boolean(), - payload: zod.object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), + payload: zod.array( + zod.object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), + ), +}); + +/** + * This endpoint is intended to be used when we need to fetch related products from the same schedule and same location. + * @summary GET Get products for user + */ +export const userProductsListByLocationParams = zod.object({ + username: zod.string(), + productHandle: zod.string(), + locationId: zod.string(), +}); + +export const userProductsListByLocationResponse = zod.object({ + success: zod.boolean(), + payload: zod.array( + zod.object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), }), - }), + ), }); /** - * @summary POST create shipping + * This endpoint should retrieve a schedule and locations belonging to a specific productHandle, along with the product. + * @summary GET Get user schedule */ -export const shippingCreateBody = zod.object({ - customerId: zod.number().optional(), - locationId: zod.string(), - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), +export const userScheduleGetByProductParams = zod.object({ + username: zod.string(), + productHandle: zod.string(), }); -export const shippingCreateResponse = zod.object({ +export const userScheduleGetByProductResponse = zod.object({ success: zod.boolean(), payload: zod .object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), - }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), - }), - }) - .and( - zod.object({ - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), - cost: zod.object({ - currency: zod.string(), - value: zod.number(), + _id: zod.string(), + name: zod.string(), + customerId: zod.number(), + slots: zod.array( + zod.object({ + day: zod.enum([ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]), + intervals: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), + }), + ), }), - }), - ) - .and( - zod.object({ - _id: zod.string(), - location: zod.string(), - origin: zod + ), + locations: zod.array( + zod .object({ locationType: zod.enum(['origin', 'destination']), customerId: zod.string(), @@ -3596,52 +3578,112 @@ export const shippingCreateResponse = zod.object({ startFee: zod.number(), }), ), + ), + }) + .and( + zod.object({ + product: zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + }) + .and( + zod.object({ + locations: zod.array( + zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + ), + }), + ), }), ), }); /** - * @summary POST get shipping calculate + * This endpoint should retrieve a schedule with products that only belong to a specific locationId. + * @summary GET Get user schedule */ -export const shippingCalculateBody = zod.object({ - customerId: zod.number().optional(), +export const userScheduleGetByLocationParams = zod.object({ + username: zod.string(), + scheduleId: zod.string(), locationId: zod.string(), - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), }); -export const shippingCalculateResponse = zod.object({ +export const userScheduleGetByLocationResponse = zod.object({ success: zod.boolean(), payload: zod .object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), - }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), - }), - }) - .and( - zod.object({ - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), - cost: zod.object({ - currency: zod.string(), - value: zod.number(), + _id: zod.string(), + name: zod.string(), + customerId: zod.number(), + slots: zod.array( + zod.object({ + day: zod.enum([ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]), + intervals: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), + }), + ), }), - }), - ) - .and( - zod.object({ - _id: zod.string(), - location: zod.string(), - origin: zod + ), + locations: zod.array( + zod .object({ locationType: zod.enum(['origin', 'destination']), customerId: zod.string(), @@ -3656,56 +3698,120 @@ export const shippingCalculateResponse = zod.object({ type: zod.enum(['Point']), coordinates: zod.array(zod.number()), }), - distanceForFree: zod.number(), - distanceHourlyRate: zod.number(), - fixedRatePerKm: zod.number(), - minDriveDistance: zod.number(), - maxDriveDistance: zod.number(), - startFee: zod.number(), - }), - ), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + ), + }) + .and( + zod.object({ + products: zod.array( + zod + .object({ + productHandle: zod.string().optional(), + productId: zod.number(), + variantId: zod.number(), + description: zod.string().optional(), + selectedOptions: zod.object({ + name: zod.string(), + value: zod.string(), + }), + price: zod.object({ + amount: zod.string(), + currencyCode: zod.string(), + }), + compareAtPrice: zod + .object({ + amount: zod.string(), + currencyCode: zod.string(), + }) + .optional(), + duration: zod.number(), + breakTime: zod.number(), + noticePeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['hours', 'days', 'weeks']), + }), + bookingPeriod: zod.object({ + value: zod.number(), + unit: zod.enum(['weeks', 'months']), + }), + }) + .and( + zod.object({ + locations: zod.array( + zod + .object({ + locationType: zod.enum(['origin', 'destination']), + customerId: zod.string(), + originType: zod.enum(['home', 'commercial']), + name: zod.string(), + fullAddress: zod.string(), + }) + .and( + zod.object({ + _id: zod.string(), + geoLocation: zod.object({ + type: zod.enum(['Point']), + coordinates: zod.array(zod.number()), + }), + distanceForFree: zod.number(), + distanceHourlyRate: zod.number(), + fixedRatePerKm: zod.number(), + minDriveDistance: zod.number(), + maxDriveDistance: zod.number(), + startFee: zod.number(), + }), + ), + ), + }), + ), + ), }), ), }); /** - * This endpoint gets shipping object - * @summary GET Get shipping + * This endpoint should return all locations present in all schedules for specific user + * @summary GET Get schedules for user */ -export const shippingGetParams = zod.object({ - shippingId: zod.string(), +export const userSchedulesListLocationsParams = zod.object({ + username: zod.string(), }); -export const shippingGetResponse = zod.object({ +export const userSchedulesListLocationsResponse = zod.object({ success: zod.boolean(), - payload: zod - .object({ - duration: zod.object({ - text: zod.string(), - value: zod.number(), - }), - distance: zod.object({ - text: zod.string(), - value: zod.number(), - }), - }) - .and( - zod.object({ - destination: zod.object({ - name: zod.string(), - fullAddress: zod.string(), - }), - cost: zod.object({ - currency: zod.string(), - value: zod.number(), + payload: zod.array( + zod.object({ + _id: zod.string(), + name: zod.string(), + customerId: zod.number(), + slots: zod.array( + zod.object({ + day: zod.enum([ + 'monday', + 'tuesday', + 'wednesday', + 'thursday', + 'friday', + 'saturday', + 'sunday', + ]), + intervals: zod.array( + zod.object({ + from: zod.string(), + to: zod.string(), + }), + ), }), - }), - ) - .and( - zod.object({ - _id: zod.string(), - location: zod.string(), - origin: zod + ), + locations: zod.array( + zod .object({ locationType: zod.enum(['origin', 'destination']), customerId: zod.string(), @@ -3728,124 +3834,105 @@ export const shippingGetResponse = zod.object({ startFee: zod.number(), }), ), - }), - ), -}); - -/** - * This endpoint is used to upload new image for customer - * @summary POST Upload new customer image - */ -export const uploadBody = zod.object({ - customerId: zod.number().or(zod.string()), - resourceUrl: zod.string(), -}); - -export const uploadResponse = zod.object({ - id: zod.string(), - statusQueryGetUri: zod.string(), - sendEventPostUri: zod.string(), - terminatePostUri: zod.string(), - rewindPostUri: zod.string(), - purgeHistoryDeleteUri: zod.string(), - restartPostUri: zod.string(), - suspendPostUri: zod.string(), - resumePostUri: zod.string(), + ), + }), + ), }); /** - * This endpoint create new blocked - * @summary POST Create blocked + * This endpoint get all users + * @summary GET Get all users */ -export const customerBlockedCreateBody = zod.object({ - title: zod.string(), - start: zod.string(), - end: zod.string(), -}); - -export const customerBlockedCreateResponse = zod.object({ +export const usersListResponse = zod.object({ success: zod.boolean(), payload: zod.object({ - _id: zod.string().optional(), - customerId: zod.number(), - start: zod.string(), - end: zod.string(), - title: zod.string(), - type: zod.string(), + nextCursor: zod.string().optional(), + results: zod.array( + zod.object({ + customerId: zod.number(), + fullname: zod.string(), + email: zod.string().email(), + phone: zod.string(), + username: zod.string(), + yearsExperience: zod.string(), + professions: zod.array(zod.string()), + specialties: zod.array(zod.string()), + aboutMe: zod.string(), + shortDescription: zod.string(), + gender: zod.string(), + social: zod.object({ + youtube: zod.string().optional(), + x: zod.string().optional(), + instagram: zod.string().optional(), + facebook: zod.string().optional(), + }), + speaks: zod.array(zod.string()), + images: zod.object({ + profile: zod + .object({ + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), + }) + .optional(), + }), + }), + ), + total: zod.number(), }), }); /** - * This endpoint destroy blocked for customer - * @summary DEL destroy blocked + * This endpoint get all users professions + * @summary GET Get all users professions with total count */ -export const customerBlockedDestroyParams = zod.object({ - customerId: zod.string(), - blockedId: zod.string(), -}); - -export const customerBlockedDestroyResponse = zod.object({ +export const usersProfessionsResponse = zod.object({ success: zod.boolean(), - payload: zod.object({ - deletedCount: zod.number(), - acknowledged: zod.boolean(), - }), + payload: zod.record(zod.string(), zod.number()), }); /** - * This endpoint get all blocked documents for customer - * @summary GET Get all blocked documents for customer + * This endpoint get all users specialties + * @summary GET Get all users specialties with total count */ -export const customerBlockedListParams = zod.object({ - customerId: zod.string(), -}); - -export const customerBlockedListQueryParams = zod.object({ - nextCursor: zod.string().optional(), - limit: zod.string().optional(), +export const usersSpecialtiesQueryParams = zod.object({ + profession: zod.string().optional(), }); -export const customerBlockedListResponse = zod.object({ +export const usersSpecialtiesResponse = zod.object({ success: zod.boolean(), - payload: zod.object({ - nextCursor: zod.string().optional(), - totalCount: zod.number(), - results: zod.array( - zod.object({ - _id: zod.string().optional(), - customerId: zod.number(), - start: zod.string(), - end: zod.string(), - title: zod.string(), - type: zod.string(), - }), - ), - }), + payload: zod.record(zod.string(), zod.number()), }); /** - * This endpoint get all blocked documents - * @summary GET Get all blocked documents for customer + * This endpoint get all users group by professions + * @summary GET Get all users grouped by professions */ -export const customerBlockedRangeParams = zod.object({ - customerId: zod.string(), -}); - -export const customerBlockedRangeQueryParams = zod.object({ - start: zod.string(), - end: zod.string(), -}); - -export const customerBlockedRangeResponse = zod.object({ +export const usersTopResponse = zod.object({ success: zod.boolean(), payload: zod.array( zod.object({ - _id: zod.string().optional(), - customerId: zod.number(), - start: zod.string(), - end: zod.string(), - title: zod.string(), - type: zod.string(), + totalUsers: zod.string(), + profession: zod.string(), + users: zod.array( + zod.object({ + customerId: zod.number(), + username: zod.string(), + fullname: zod.string(), + aboutMe: zod.string().optional(), + shortDescription: zod.string(), + professions: zod.string(), + images: zod.object({ + profile: zod + .object({ + url: zod.string().url().optional(), + width: zod.number().optional(), + height: zod.number().optional(), + }) + .optional(), + }), + }), + ), }), ), }); diff --git a/app/routes/($locale)._index.tsx b/app/routes/($locale)._index.tsx index 5c54dc64..5ac6829b 100644 --- a/app/routes/($locale)._index.tsx +++ b/app/routes/($locale)._index.tsx @@ -65,7 +65,7 @@ export async function loader(args: LoaderFunctionArgs) { [], }); - const response = await loaderProfessions(args); + const professions = loaderProfessions(args).then((r) => r.json()); const artists = getBookingShopifyApi().usersList({ limit: '8', @@ -89,7 +89,7 @@ export async function loader(args: LoaderFunctionArgs) { collections, artists, components, - professions: response.json(), + professions, }); } @@ -159,9 +159,10 @@ function FeaturedArtists({ fallback={ <> - - - + + + + } > diff --git a/app/routes/($locale).account.payouts._index.tsx b/app/routes/($locale).account.payouts._index.tsx new file mode 100644 index 00000000..9013aa6e --- /dev/null +++ b/app/routes/($locale).account.payouts._index.tsx @@ -0,0 +1,115 @@ +import { + Badge, + Button, + Card, + SimpleGrid, + Stack, + Table, + Text, + Title, +} from '@mantine/core'; +import {Form, Link, useLoaderData} from '@remix-run/react'; +import {json, type LoaderFunctionArgs} from '@shopify/remix-oxygen'; +import {format} from 'date-fns'; +import {da} from 'date-fns/locale'; +import {getBookingShopifyApi} from '~/lib/api/bookingShopifyApi'; +import {getCustomer} from '~/lib/get-customer'; +import {isMobilePay} from './($locale).account.payouts'; + +export async function loader({context}: LoaderFunctionArgs) { + const customer = await getCustomer({context}); + const {payload} = await getBookingShopifyApi().customerPayoutAccountGet( + customer.id, + ); + + return json({payoutAccount: payload}); +} + +const elements = [ + {position: 6, mass: 12.011, symbol: 'C', name: 'Carbon'}, + {position: 7, mass: 14.007, symbol: 'N', name: 'Nitrogen'}, + {position: 39, mass: 88.906, symbol: 'Y', name: 'Yttrium'}, + {position: 56, mass: 137.33, symbol: 'Ba', name: 'Barium'}, + {position: 58, mass: 140.12, symbol: 'Ce', name: 'Cerium'}, +]; + +export default function AccountPayoutsIndex() { + const data = useLoaderData(); + const rows = elements.map((element) => ( + + {format(new Date(), 'yyyy-MM-dd', {locale: da})} + + Overført + + 0.00 DKK + + )); + + return ( + + + + + {data.payoutAccount ? ( + <> + {isMobilePay(data.payoutAccount.payoutDetails) ? ( + <> + MobilePay overførsel + {data.payoutAccount.payoutDetails.phoneNumber} + + ) : ( + <> + Bank overførsel + {data.payoutAccount.payoutDetails.bankName} + + {data.payoutAccount.payoutDetails.regNum} /{' '} + {data.payoutAccount.payoutDetails.accountNum} + + + )} +
+ +
+ + ) : ( + <> + + For at kunne modtag betaling, skal du vælge overførselsmetode + du ønsker + + + + )} +
+
+
+ +
+ Historik + Listen af alle udbetalinger der er foretagt +
+ + + + + + Dato + Status + Beløb + + + {rows} +
+
+
+ ); +} diff --git a/app/routes/($locale).account.payouts.create.tsx b/app/routes/($locale).account.payouts.create.tsx new file mode 100644 index 00000000..18474c32 --- /dev/null +++ b/app/routes/($locale).account.payouts.create.tsx @@ -0,0 +1,168 @@ +import {parseWithZod} from '@conform-to/zod'; +import { + Flex, + InputBase, + Radio, + Stack, + Text, + TextInput, + Title, +} from '@mantine/core'; +import {redirect, type ActionFunctionArgs} from '@shopify/remix-oxygen'; +import {IMaskInput} from 'react-imask'; +import {getCustomer} from '~/lib/get-customer'; + +import { + getCollectionProps, + getFormProps, + getInputProps, + useForm, + useInputControl, +} from '@conform-to/react'; +import {Form, useActionData} from '@remix-run/react'; + +import {SubmitButton} from '~/components/form/SubmitButton'; +import {getBookingShopifyApi} from '~/lib/api/bookingShopifyApi'; +import {CustomerPayoutAccountType} from '~/lib/api/model'; +import {customerPayoutAccountCreateBody} from '~/lib/zod/bookingShopifyApi'; +import {isMobilePay} from './($locale).account.payouts'; + +const schema = customerPayoutAccountCreateBody; + +export const action = async ({request, context}: ActionFunctionArgs) => { + const customer = await getCustomer({context}); + const formData = await request.formData(); + const submission = parseWithZod(formData, { + schema, + }); + + if (submission.status !== 'success') { + return submission.reply(); + } + + try { + const values = submission.value; + await getBookingShopifyApi().customerPayoutAccountCreate( + customer.id, + isMobilePay(values.payoutDetails) + ? { + ...values, + payoutDetails: { + phoneNumber: parseInt( + values.payoutDetails.phoneNumber + .toString() + .replace(/\D/g, '') + .slice(2), + 10, + ), + }, + } + : { + ...values, + payoutDetails: { + ...values.payoutDetails, + accountNum: parseInt( + values.payoutDetails.accountNum.toString().replace(/-/g, ''), + ), + }, + }, + ); + + return redirect(`/account/payouts`); + } catch (error) { + return submission.reply(); + } +}; + +export default function AccountPayoutsSettings() { + const lastResult = useActionData(); + + const [form, fields] = useForm({ + lastResult, + defaultValue: { + payoutType: CustomerPayoutAccountType.MOBILE_PAY, + }, + onValidate({formData}) { + return parseWithZod(formData, { + schema, + }); + }, + shouldValidate: 'onBlur', + shouldRevalidate: 'onInput', + }); + + const payoutType = useInputControl(fields.payoutType); + + return ( +
+ +
+ Bank konto + + Vi skal bruge din regnr og kontonummer for at sende dig din + udbetalinger. + +
+ + + {getCollectionProps(fields.payoutType, { + type: 'radio', + options: [ + CustomerPayoutAccountType.BANK_ACCOUNT, + CustomerPayoutAccountType.MOBILE_PAY, + ], + }).map((props) => ( + + ))} + + + {payoutType.value === CustomerPayoutAccountType.BANK_ACCOUNT ? ( + <> + + + + + + + ) : ( + + )} + + Gem +
+
+ ); +} diff --git a/app/routes/($locale).account.payouts.destroy.tsx b/app/routes/($locale).account.payouts.destroy.tsx new file mode 100644 index 00000000..bd818f94 --- /dev/null +++ b/app/routes/($locale).account.payouts.destroy.tsx @@ -0,0 +1,11 @@ +import {redirect, type ActionFunction} from '@shopify/remix-oxygen'; +import {getBookingShopifyApi} from '~/lib/api/bookingShopifyApi'; +import {getCustomer} from '~/lib/get-customer'; + +export const action: ActionFunction = async ({context, params}) => { + const customer = await getCustomer({context}); + + await getBookingShopifyApi().customerPayoutAccountDestroy(customer.id); + + return redirect(`/account/payouts`); +}; diff --git a/app/routes/($locale).account.payouts.tsx b/app/routes/($locale).account.payouts.tsx new file mode 100644 index 00000000..9d976b5a --- /dev/null +++ b/app/routes/($locale).account.payouts.tsx @@ -0,0 +1,40 @@ +import {Outlet} from '@remix-run/react'; + +import {json, type LoaderFunctionArgs} from '@shopify/remix-oxygen'; +import {AccountContent} from '~/components/account/AccountContent'; +import {AccountTitle} from '~/components/account/AccountTitle'; +import type { + CustomerPayoutAccountPayoutDetails, + CustomerPayoutBankAccount, + CustomerPayoutMobilePay, +} from '~/lib/api/model'; +import {getCustomer} from '~/lib/get-customer'; + +export function isMobilePay( + details: CustomerPayoutAccountPayoutDetails, +): details is CustomerPayoutMobilePay { + return (details as CustomerPayoutMobilePay).phoneNumber !== undefined; +} + +export function isBankAccount( + details: CustomerPayoutAccountPayoutDetails, +): details is CustomerPayoutBankAccount { + return (details as CustomerPayoutBankAccount).bankName !== undefined; +} + +export async function loader({context}: LoaderFunctionArgs) { + const customer = await getCustomer({context}); + return json({}); +} + +export default function AccountPayouts() { + return ( + <> + + + + + + + ); +} diff --git a/app/routes/($locale).account.tsx b/app/routes/($locale).account.tsx index 0aab1838..3c8ed49c 100644 --- a/app/routes/($locale).account.tsx +++ b/app/routes/($locale).account.tsx @@ -21,7 +21,7 @@ export async function loader({request, context}: LoaderFunctionArgs) { const isLoggedIn = !!customerAccessToken?.accessToken; const isAccountHome = pathname === '/account' || pathname === '/account/'; const isPrivateRoute = - /^\/account\/(orders|orders\/.*|business|profile|dashboard|addresses|upload|public|public\/.*|booked|booked\/.*|bookings|bookings\/.*|password|locations|locations\/.*|services|services\/.*|schedules|schedules\/.*|addresses\/.*)$/.test( + /^\/account\/(payouts|orders|business|profile|dashboard|addresses|upload|public|booked|bookings|password|locations|services|schedules)(\/.*)?$/.test( pathname, ); diff --git a/openapi.yaml b/openapi.yaml index 57fa2790..e171764f 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -116,6 +116,50 @@ components: required: - success - payload + CustomerPayoutAccount: + type: object + properties: + customerId: + oneOf: + - type: string + - type: integer + payoutType: + $ref: '#/components/schemas/CustomerPayoutAccountType' + payoutDetails: + oneOf: + - $ref: '#/components/schemas/CustomerPayoutMobilePay' + - $ref: '#/components/schemas/CustomerPayoutBankAccount' + required: + - customerId + - payoutType + - payoutDetails + CustomerPayoutAccountType: + type: string + enum: + - MOBILE_PAY + - BANK_ACCOUNT + CustomerPayoutMobilePay: + type: object + properties: + phoneNumber: + oneOf: + - type: string + - type: integer + required: + - phoneNumber + CustomerPayoutBankAccount: + type: object + properties: + bankName: + type: string + regNum: + type: integer + accountNum: + type: integer + required: + - bankName + - regNum + - accountNum CustomerProductBase: type: object properties: @@ -2589,26 +2633,26 @@ components: - images - variantId paths: - /products/get-users-image: + /customer: post: tags: - - Products - operationId: productsGetUsersImage - summary: POST get users belongs to productIds array - description: This endpoint respond with users images + - Customer + operationId: customerCreate + summary: PUT Create user + description: This endpoint creates new user requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/ProductsGetUsersImageBody' + $ref: '#/components/schemas/CustomerCreateBody' responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/ProductsGetUsersImageResponse' + $ref: '#/components/schemas/CustomerCreateResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -2616,72 +2660,58 @@ paths: '403': $ref: '#/components/responses/ForbiddenResponse' security: [] - /products/get-users-by-variant: - parameters: - - name: productId - in: query - description: product Id - required: true - schema: - type: string - - name: variantId - in: query - description: variant Id - schema: - type: string - - name: nextCursor - in: query - description: nextCursor - schema: - type: string - - name: limit - in: query - description: limit items (default 5) - schema: - type: string - get: + '/customer/{customerId}': + put: + parameters: + - name: customerId + in: path + required: true + schema: + type: string tags: - - Products - operationId: productsGetUsersByVariant - summary: GET Get all users for specific productId and variantId - description: This endpoint get all users for specific productId and variantId + - Customer + operationId: customerUpdate + summary: PUT Update user + description: This endpoint update user + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CustomerUpdateBody' responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/ProductsGetUsersByVariantResponse' + $ref: '#/components/schemas/CustomerUpdateResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/username-taken': get: parameters: - - name: username + - name: customerId in: path - description: username required: true schema: type: string tags: - - User - operationId: userUsernameTaken - summary: GET check if username is taken - description: This endpoint return false or true + - Customer + operationId: customerGet + summary: GET Get customer + description: This endpoint gets customer object responses: '200': description: Response with payload content: application/json: schema: - $ref: '#/components/schemas/UserUsernameTakenResponse' + $ref: '#/components/schemas/CustomerGetResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -2691,27 +2721,33 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}': + '/customer/{customerId}/blocked': parameters: - - name: username + - name: customerId in: path - description: username + description: The ID of the customerId required: true schema: type: string - get: + post: tags: - - User - operationId: userGet - summary: GET Get user - description: This endpoint gets user object + - CustomerBlocked + operationId: customerBlockedCreate + summary: POST Create blocked + description: This endpoint create new blocked + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CustomerBlockedCreateBody' responses: '200': - description: Response with payload + description: Response with blocked payload content: application/json: schema: - $ref: '#/components/schemas/UserGetResponse' + $ref: '#/components/schemas/CustomerBlockedCreateResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -2721,66 +2757,73 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/products/{productHandle}': - get: + '/customer/{customerId}/blocked/{blockedId}': + delete: parameters: - - name: username + - name: customerId in: path + description: The ID of the customerId required: true schema: type: string - - name: productHandle + - name: blockedId in: path + description: The ID of the blockedId to be destroyed required: true schema: type: string tags: - - UserProduct - operationId: UserProductGet - summary: GET Get product that exist in one of the schedules for customer - description: This endpoint get product for customer + - CustomerBlocked + operationId: customerBlockedDestroy + summary: DEL destroy blocked + description: This endpoint destroy blocked for customer responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/UserProductsGetResponse' + $ref: '#/components/schemas/CustomerBlockedDestroyResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/products': + '/customer/{customerId}/blocked/list': get: parameters: - - name: username + - name: customerId in: path - description: username is needed + description: The ID of the customerId required: true schema: type: string - - name: scheduleId + - name: nextCursor in: query - description: scheduleId is optional + description: paginate + required: false + schema: + type: string + - name: limit + in: query + description: limit counts of documents + required: false schema: type: string tags: - - UserProduct - operationId: userProductsListBySchedule - summary: GET Get products for user - description: This endpoint get products for user (across all schedules or one scheduleId) + - CustomerBlocked + operationId: customerBlockedList + summary: GET Get all blocked documents for customer + description: This endpoint get all blocked documents for customer responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/UserProductsListByScheduleResponse' + $ref: '#/components/schemas/CustomerBlockedListResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -2788,113 +2831,123 @@ paths: '403': $ref: '#/components/responses/ForbiddenResponse' security: [] - '/user/{username}/product/{productHandle}/location/{locationId}': + '/customer/{customerId}/blocked/range': get: parameters: - - name: username + - name: customerId in: path - description: username is needed + description: customerId for the customer required: true schema: type: string - - name: productHandle - in: path - description: productHandle is nedded + - name: start + in: query + description: start of date required: true schema: type: string - - name: locationId - in: path - description: locationId is nedded + - name: end + in: query + description: end of date required: true schema: type: string tags: - - UserProduct - operationId: userProductsListByLocation - summary: GET Get products for user - description: This endpoint is intended to be used when we need to fetch related products from the same schedule and same location. + - CustomerBlocked + operationId: customerBlockedRange + summary: GET Get all blocked documents for customer + description: This endpoint get all blocked documents responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/UserProductsListByLocationResponse' + $ref: '#/components/schemas/CustomerBlockedRangeResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/products/location/{locationId}': - post: + '/customer/{customerId}/bookings/{orderId}/group/{groupId}': + get: parameters: - - name: username + - name: customerId in: path - description: username is needed + description: customerId for the customer required: true schema: type: string - - name: locationId + - name: orderId in: path - description: locationId is nedded + description: orderId for the order + required: true + schema: + type: string + - name: groupId + in: path + description: groupId for the order required: true schema: type: string tags: - - UserProduct - operationId: userProductsGetProducts - summary: GET Get products for user - description: This endpoint get products from one schedule by location - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/UserProductsGetProductsBody' + - CustomerBooking + operationId: customerBookingGetByGroup + summary: GET Get order with lineItems array for specific groupId + description: This endpoint gets order with lineItems array of objects specific for groupId responses: '200': - description: Response + description: Response with payload content: application/json: schema: - $ref: '#/components/schemas/UserProductsGetProductsResponse' + $ref: '#/components/schemas/CustomerBookingGetByGroupIdResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/schedule/get-by-product-id/{productHandle}': + '/customer/{customerId}/bookings/range': get: parameters: - - name: username + - name: customerId in: path - description: username + description: customerId for the customer required: true schema: type: string - - name: productHandle - in: path - description: productHandle + - name: start + in: query + description: start of date required: true schema: type: string - tags: - - UserSchedule - operationId: userScheduleGetByProduct - summary: GET Get user schedule - description: 'This endpoint should retrieve a schedule and locations belonging to a specific productHandle, along with the product.' + - name: end + in: query + description: end of date + required: true + schema: + type: string + tags: + - CustomerBooking + operationId: customerBookingRange + summary: GET Get all bookings for customer from orders + description: This endpoint get all bookings from orders responses: '200': - description: Response with payload + description: Response content: application/json: schema: - $ref: '#/components/schemas/UserScheduleGetByProductIdResponse' + $ref: '#/components/schemas/CustomerBookingRangeResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -2904,49 +2957,43 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/schedules/locations': + '/customer/{customerId}/location/{locationId}': get: parameters: - - name: username + - name: customerId + in: path + required: true + schema: + type: string + - name: locationId in: path - description: username is needed required: true schema: type: string tags: - - UserSchedule - operationId: userSchedulesListLocations - summary: GET Get schedules for user - description: This endpoint should return all locations present in all schedules for specific user + - CustomerLocation + operationId: customerLocationGet + summary: GET Get one location from user + description: This endpoint get one location for user responses: '200': description: Response content: application/json: schema: - type: object - properties: - success: - type: boolean - example: true - payload: - type: array - items: - $ref: '#/components/schemas/UserScheduleWithLocations' - required: - - success - - payload + $ref: '#/components/schemas/CustomerLocationGetResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/location/{locationId}': - get: + delete: parameters: - - name: username + - name: customerId in: path required: true schema: @@ -2957,116 +3004,145 @@ paths: schema: type: string tags: - - UserLocation - operationId: userLocationGet - summary: GET Get one location from user - description: This endpoint get one location for user + - CustomerLocation + operationId: customerLocationRemove + summary: POST Remove location from user + description: This endpoint remove location but does not delete location from db responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/UserLocationGetResponse' + $ref: '#/components/schemas/CustomerLocationRemoveResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/schedule/{scheduleId}/location/{locationId}': - get: + put: parameters: - - name: username + - name: customerId in: path - description: username required: true schema: type: string - - name: scheduleId + - name: locationId + in: path + required: true + schema: + type: string + tags: + - CustomerLocation + operationId: customerLocationUpdate + summary: PUT Update location + description: This endpoint update existing location + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CustomerLocationUpdateBody' + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/CustomerLocationUpdateResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + security: [] + '/customer/{customerId}/location/{locationId}/setDefault': + put: + parameters: + - name: customerId in: path - description: schedule Id required: true schema: type: string - name: locationId in: path - description: location id required: true schema: type: string tags: - - UserSchedule - operationId: userScheduleGetByLocation - summary: GET Get user schedule - description: This endpoint should retrieve a schedule with products that only belong to a specific locationId. + - CustomerLocation + operationId: customerLocationSetDefault + summary: POST Set new default location for user + description: This endpoint set new default location for user responses: '200': - description: Response with payload + description: Response content: application/json: schema: - $ref: '#/components/schemas/UserScheduleGetByLocationResponse' + $ref: '#/components/schemas/CustomerLocationSetDefaultResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' security: [] - /users/top: - parameters: - - name: limit - in: query - description: limit items (default 5) - schema: - type: string - - name: page - in: query - description: page - schema: - type: string - get: + '/customer/{customerId}/locations': + post: + parameters: + - name: customerId + in: path + required: true + schema: + type: string tags: - - User - operationId: usersTop - summary: GET Get all users grouped by professions - description: This endpoint get all users group by professions + - CustomerLocation + operationId: customerLocationCreate + summary: POST Create location origin or destination + description: This endpoint creates new location + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CustomerLocationCreateBody' responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/UsersTopResponse' + $ref: '#/components/schemas/CustomerLocationCreateResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' security: [] - /users/professions: get: + parameters: + - name: customerId + in: path + required: true + schema: + type: string tags: - - User - operationId: usersProfessions - summary: GET Get all users professions with total count - description: This endpoint get all users professions + - CustomerLocation + operationId: customerLocationList + summary: GET Get all locations for user + description: This endpoint get all locations for user responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/UsersProfessionsResponse' + $ref: '#/components/schemas/CustomerLocationListResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -3076,26 +3152,33 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - /users/specialties: + '/customer/{customerId}/orders/{orderId}': get: parameters: - - name: profession - in: query - description: profession + - name: customerId + in: path + description: customerId for the customer + required: true + schema: + type: string + - name: orderId + in: path + description: orderId for the order + required: true schema: type: string tags: - - User - operationId: usersSpecialties - summary: GET Get all users specialties with total count - description: This endpoint get all users specialties + - CustomerOrder + operationId: customerOrderGet + summary: GET Get order with lineItems array + description: This endpoint gets order with lineItems array of objects responses: '200': - description: Response + description: Response with payload content: application/json: schema: - $ref: '#/components/schemas/UsersSpecialtiesResponse' + $ref: '#/components/schemas/CustomerOrderGetResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -3105,218 +3188,92 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - '/user/{username}/availability/{locationId}/generate': - parameters: - - name: username - in: path - description: This field for username - required: true - schema: - type: string - - name: locationId - in: path - description: This field for locationId - required: true - schema: - type: string + '/customer/{customerId}/payout-account': post: + parameters: + - name: customerId + in: path + description: The ID of the customerId + required: true + schema: + type: string tags: - - UserAvailability - operationId: userAvailabilityGenerate - summary: POST generate availabilty for user - description: This endpoint generate availabilty for user + - CustomerPayoutAccount + operationId: customerPayoutAccountCreate + summary: POST Create payout account + description: This endpoint create new payout account requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/UserAvailabilityGenerateBody' + type: object + properties: + payoutType: + $ref: '#/components/schemas/CustomerPayoutAccountType' + payoutDetails: + oneOf: + - $ref: '#/components/schemas/CustomerPayoutMobilePay' + - $ref: '#/components/schemas/CustomerPayoutBankAccount' + required: + - payoutType + - payoutDetails responses: '200': - description: Response + description: Response with payout account payload content: application/json: schema: - $ref: '#/components/schemas/UserAvailabilityGenerateResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - security: [] - '/user/{username}/availability/{locationId}/get': - parameters: - - name: username - in: path - description: This field for username - required: true - schema: - type: string - - name: locationId - in: path - description: This field for locationId - required: true - schema: - type: string - post: - tags: - - UserAvailability - operationId: UserAvailabilityGet - summary: POST get single availabilty for user - description: This endpoint get's one single availabilty for user - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/UserAvailabilityGetBody' - responses: - '200': - description: Response - content: - application/json: - schema: - $ref: '#/components/schemas/UserAvailabilityGeResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - security: [] - /users: - parameters: - - name: nextCursor - in: query - description: nextCursor - schema: - type: string - - name: limit - in: query - description: limit items (default 10) - schema: - type: string - - name: profession - in: query - description: profession - schema: - type: string - - name: specialties - in: query - description: specialties - schema: - type: array - items: - type: string - - name: sortOrder - in: query - description: asc or desc - schema: - type: string - get: - tags: - - User - operationId: usersList - summary: GET Get all users - description: This endpoint get all users - responses: - '200': - description: Response - content: - application/json: - schema: - $ref: '#/components/schemas/UsersListResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' - security: [] - '/customer/{customerId}/upload/resource-url': - get: - parameters: - - name: customerId - in: path - required: true - schema: - type: string - tags: - - Customer - operationId: customerUploadResourceURL - summary: GET Get customer upload resource url - description: 'This endpoint gets customer upload resource url, so customer can upload image' - responses: - '200': - description: Response with payload - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerUploadResourceURLResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' - security: [] - '/customer/{customerId}': - put: - parameters: - - name: customerId - in: path - required: true - schema: - type: string - tags: - - Customer - operationId: customerUpdate - summary: PUT Update user - description: This endpoint update user - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerUpdateBody' - responses: - '200': - description: Response - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerUpdateResponse' + type: object + properties: + success: + type: boolean + example: true + payload: + $ref: '#/components/schemas/CustomerPayoutAccount' + required: + - success + - payload '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] get: parameters: - name: customerId in: path + description: The ID of the customerId required: true schema: type: string tags: - - Customer - operationId: customerGet - summary: GET Get customer - description: This endpoint gets customer object + - CustomerPayoutAccount + operationId: customerPayoutAccountGet + summary: GET get payout account + description: This endpoint get payout account responses: '200': - description: Response with payload + description: Response with payout account payload content: application/json: schema: - $ref: '#/components/schemas/CustomerGetResponse' + type: object + properties: + success: + type: boolean + example: true + payload: + allOf: + - $ref: '#/components/schemas/CustomerPayoutAccount' + nullable: true + required: + - success + - payload '400': $ref: '#/components/responses/BadResponse' '401': @@ -3326,91 +3283,49 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - '/customer/{customerId}/status': - get: + delete: parameters: - name: customerId in: path + description: The ID of the customerId required: true schema: type: string tags: - - Customer - operationId: customerStatus - summary: GET Get customer status - description: This endpoint gets customer status - responses: - '200': - description: Response with payload - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerStatusResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' - security: [] - /customer: - post: - tags: - - Customer - operationId: customerCreate - summary: PUT Create user - description: This endpoint creates new user - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerCreateBody' + - CustomerPayoutAccount + operationId: customerPayoutAccountDestroy + summary: DEL destroy payout account + description: This endpoint destroy payout account for customer responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/CustomerCreateResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - security: [] - '/customer/{customerId}/isBusiness': - get: - parameters: - - name: customerId - in: path - description: CustomerId from shopify - required: true - schema: - type: string - tags: - - Customer - operationId: customerIsBusiness - summary: GET Get customer is business - description: This endpoint return if customer is business or not - responses: - '200': - description: Response with payload - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerIsBusinessResponse' + type: object + properties: + success: + type: boolean + example: true + payload: + type: object + properties: + deletedCount: + type: number + acknowledged: + type: boolean + required: + - deletedCount + - acknowledged + required: + - success + - payload '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' security: [] '/customer/{customerId}/products': parameters: @@ -3592,117 +3507,26 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - '/customer/{customerId}/bookings/{orderId}/group/{groupId}': + '/customer/{customerId}/upload/resource-url': get: parameters: - name: customerId in: path - description: customerId for the customer - required: true - schema: - type: string - - name: orderId - in: path - description: orderId for the order - required: true - schema: - type: string - - name: groupId - in: path - description: groupId for the order required: true schema: type: string tags: - - CustomerBooking - operationId: customerBookingGetByGroup - summary: GET Get order with lineItems array for specific groupId - description: This endpoint gets order with lineItems array of objects specific for groupId - responses: - '200': - description: Response with payload - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerBookingGetByGroupIdResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' - security: [] - '/customer/{customerId}/bookings/range': - get: - parameters: - - name: customerId - in: path - description: customerId for the customer - required: true - schema: - type: string - - name: start - in: query - description: start of date - required: true - schema: - type: string - - name: end - in: query - description: end of date - required: true - schema: - type: string - tags: - - CustomerBooking - operationId: customerBookingRange - summary: GET Get all bookings for customer from orders - description: This endpoint get all bookings from orders - responses: - '200': - description: Response - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerBookingRangeResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' - security: [] - '/customer/{customerId}/orders/{orderId}': - get: - parameters: - - name: customerId - in: path - description: customerId for the customer - required: true - schema: - type: string - - name: orderId - in: path - description: orderId for the order - required: true - schema: - type: string - tags: - - CustomerOrder - operationId: customerOrderGet - summary: GET Get order with lineItems array - description: This endpoint gets order with lineItems array of objects + - Customer + operationId: customerUploadResourceURL + summary: GET Get customer upload resource url + description: 'This endpoint gets customer upload resource url, so customer can upload image' responses: '200': description: Response with payload content: application/json: schema: - $ref: '#/components/schemas/CustomerOrderGetResponse' + $ref: '#/components/schemas/CustomerUploadResourceURLResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -3902,31 +3726,26 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - /meta/professions: + '/customer/{customerId}/status': get: + parameters: + - name: customerId + in: path + required: true + schema: + type: string tags: - - Meta - operationId: metaProfessions - summary: GET Get all professions - description: This endpoint get all professions + - Customer + operationId: customerStatus + summary: GET Get customer status + description: This endpoint gets customer status responses: '200': - description: Response + description: Response with payload content: application/json: schema: - type: object - properties: - success: - type: boolean - example: true - payload: - type: array - items: - $ref: '#/components/schemas/MetaItem' - required: - - success - - payload + $ref: '#/components/schemas/CustomerStatusResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -3936,31 +3755,27 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - /meta/specialties: + '/customer/{customerId}/isBusiness': get: + parameters: + - name: customerId + in: path + description: CustomerId from shopify + required: true + schema: + type: string tags: - - Meta - operationId: metaspecialties - summary: GET Get all specialties - description: This endpoint get all specialties + - Customer + operationId: customerIsBusiness + summary: GET Get customer is business + description: This endpoint return if customer is business or not responses: '200': - description: Response + description: Response with payload content: application/json: schema: - type: object - properties: - success: - type: boolean - example: true - payload: - type: array - items: - $ref: '#/components/schemas/MetaItem' - required: - - success - - payload + $ref: '#/components/schemas/CustomerIsBusinessResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -3970,63 +3785,57 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - '/customer/{customerId}/location/{locationId}/setDefault': - put: + /location/get-coordinates: + get: parameters: - - name: customerId - in: path - required: true - schema: - type: string - - name: locationId - in: path - required: true + - name: fullAddress + in: query schema: type: string tags: - - CustomerLocation - operationId: customerLocationSetDefault - summary: POST Set new default location for user - description: This endpoint set new default location for user + - Location + operationId: locationGetCoordinates + summary: GET location coordinates + description: This endpoint get coordinates object responses: '200': - description: Response + description: Response with payload content: application/json: schema: - $ref: '#/components/schemas/CustomerLocationSetDefaultResponse' + $ref: '#/components/schemas/LocationGetCoordinatesResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] - '/customer/{customerId}/location/{locationId}': + /location/get-travel-time: get: parameters: - - name: customerId - in: path - required: true + - name: origin + in: query schema: type: string - - name: locationId - in: path - required: true + - name: destination + in: query schema: type: string tags: - - CustomerLocation - operationId: customerLocationGet - summary: GET Get one location from user - description: This endpoint get one location for user + - Location + operationId: locationGetTravelTime + summary: GET location travel time + description: This endpoint gets traval time object responses: '200': - description: Response + description: Response with payload content: application/json: schema: - $ref: '#/components/schemas/CustomerLocationGetResponse' + $ref: '#/components/schemas/LocationGetTravelTimeResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -4036,100 +3845,94 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - delete: - parameters: - - name: customerId - in: path - required: true - schema: - type: string - - name: locationId - in: path - required: true - schema: - type: string + /meta/professions: + get: tags: - - CustomerLocation - operationId: customerLocationRemove - summary: POST Remove location from user - description: This endpoint remove location but does not delete location from db + - Meta + operationId: metaProfessions + summary: GET Get all professions + description: This endpoint get all professions responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/CustomerLocationRemoveResponse' + type: object + properties: + success: + type: boolean + example: true + payload: + type: array + items: + $ref: '#/components/schemas/MetaItem' + required: + - success + - payload '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] - put: - parameters: - - name: customerId - in: path - required: true - schema: - type: string - - name: locationId - in: path - required: true - schema: - type: string + /meta/specialties: + get: tags: - - CustomerLocation - operationId: customerLocationUpdate - summary: PUT Update location - description: This endpoint update existing location - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CustomerLocationUpdateBody' + - Meta + operationId: metaspecialties + summary: GET Get all specialties + description: This endpoint get all specialties responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/CustomerLocationUpdateResponse' + type: object + properties: + success: + type: boolean + example: true + payload: + type: array + items: + $ref: '#/components/schemas/MetaItem' + required: + - success + - payload '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] - '/customer/{customerId}/locations': + /orchestrators/upload: post: - parameters: - - name: customerId - in: path - required: true - schema: - type: string tags: - - CustomerLocation - operationId: customerLocationCreate - summary: POST Create location origin or destination - description: This endpoint creates new location + - Orchestrators + operationId: upload + summary: POST Upload new customer image + description: This endpoint is used to upload new image for customer requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/CustomerLocationCreateBody' + $ref: '#/components/schemas/UploadBody' responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/CustomerLocationCreateResponse' + $ref: '#/components/schemas/UploadResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -4137,85 +3940,69 @@ paths: '403': $ref: '#/components/responses/ForbiddenResponse' security: [] - get: - parameters: - - name: customerId - in: path - required: true - schema: - type: string + /products/get-users-image: + post: tags: - - CustomerLocation - operationId: customerLocationList - summary: GET Get all locations for user - description: This endpoint get all locations for user + - Products + operationId: productsGetUsersImage + summary: POST get users belongs to productIds array + description: This endpoint respond with users images + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ProductsGetUsersImageBody' responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/CustomerLocationListResponse' - '400': - $ref: '#/components/responses/BadResponse' - '401': - $ref: '#/components/responses/UnauthorizedResponse' - '403': - $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' - security: [] - /location/get-coordinates: - get: - parameters: - - name: fullAddress - in: query - schema: - type: string - tags: - - Location - operationId: locationGetCoordinates - summary: GET location coordinates - description: This endpoint get coordinates object - responses: - '200': - description: Response with payload - content: - application/json: - schema: - $ref: '#/components/schemas/LocationGetCoordinatesResponse' + $ref: '#/components/schemas/ProductsGetUsersImageResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' security: [] - /location/get-travel-time: + /products/get-users-by-variant: + parameters: + - name: productId + in: query + description: product Id + required: true + schema: + type: string + - name: variantId + in: query + description: variant Id + schema: + type: string + - name: nextCursor + in: query + description: nextCursor + schema: + type: string + - name: limit + in: query + description: limit items (default 5) + schema: + type: string get: - parameters: - - name: origin - in: query - schema: - type: string - - name: destination - in: query - schema: - type: string tags: - - Location - operationId: locationGetTravelTime - summary: GET location travel time - description: This endpoint gets traval time object + - Products + operationId: productsGetUsersByVariant + summary: GET Get all users for specific productId and variantId + description: This endpoint get all users for specific productId and variantId responses: '200': - description: Response with payload + description: Response content: application/json: schema: - $ref: '#/components/schemas/LocationGetTravelTimeResponse' + $ref: '#/components/schemas/ProductsGetUsersByVariantResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -4306,26 +4093,39 @@ paths: '404': $ref: '#/components/responses/NotFoundResponse' security: [] - /orchestrators/upload: + '/user/{username}/availability/{locationId}/generate': + parameters: + - name: username + in: path + description: This field for username + required: true + schema: + type: string + - name: locationId + in: path + description: This field for locationId + required: true + schema: + type: string post: tags: - - Orchestrators - operationId: upload - summary: POST Upload new customer image - description: This endpoint is used to upload new image for customer + - UserAvailability + operationId: userAvailabilityGenerate + summary: POST generate availabilty for user + description: This endpoint generate availabilty for user requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/UploadBody' + $ref: '#/components/schemas/UserAvailabilityGenerateBody' responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/UploadResponse' + $ref: '#/components/schemas/UserAvailabilityGenerateResponse' '400': $ref: '#/components/responses/BadResponse' '401': @@ -4333,149 +4133,532 @@ paths: '403': $ref: '#/components/responses/ForbiddenResponse' security: [] - '/customer/{customerId}/blocked': + '/user/{username}/availability/{locationId}/get': parameters: - - name: customerId + - name: username in: path - description: The ID of the customerId + description: This field for username + required: true + schema: + type: string + - name: locationId + in: path + description: This field for locationId required: true schema: type: string post: tags: - - CustomerBlocked - operationId: customerBlockedCreate - summary: POST Create blocked - description: This endpoint create new blocked + - UserAvailability + operationId: UserAvailabilityGet + summary: POST get single availabilty for user + description: This endpoint get's one single availabilty for user requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/CustomerBlockedCreateBody' + $ref: '#/components/schemas/UserAvailabilityGetBody' responses: '200': - description: Response with blocked payload + description: Response content: application/json: schema: - $ref: '#/components/schemas/CustomerBlockedCreateResponse' + $ref: '#/components/schemas/UserAvailabilityGeResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' - '404': - $ref: '#/components/responses/NotFoundResponse' security: [] - '/customer/{customerId}/blocked/{blockedId}': - delete: + '/user/{username}/location/{locationId}': + get: parameters: - - name: customerId + - name: username in: path - description: The ID of the customerId required: true schema: type: string - - name: blockedId + - name: locationId in: path - description: The ID of the blockedId to be destroyed required: true schema: type: string tags: - - CustomerBlocked - operationId: customerBlockedDestroy - summary: DEL destroy blocked - description: This endpoint destroy blocked for customer + - UserLocation + operationId: userLocationGet + summary: GET Get one location from user + description: This endpoint get one location for user responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/CustomerBlockedDestroyResponse' + $ref: '#/components/schemas/UserLocationGetResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] - '/customer/{customerId}/blocked/list': + '/user/{username}': + parameters: + - name: username + in: path + description: username + required: true + schema: + type: string get: - parameters: - - name: customerId - in: path - description: The ID of the customerId - required: true - schema: - type: string - - name: nextCursor - in: query - description: paginate - required: false - schema: - type: string - - name: limit - in: query - description: limit counts of documents - required: false - schema: - type: string tags: - - CustomerBlocked - operationId: customerBlockedList - summary: GET Get all blocked documents for customer - description: This endpoint get all blocked documents for customer - responses: + - User + operationId: userGet + summary: GET Get user + description: This endpoint gets user object + responses: '200': - description: Response + description: Response with payload content: application/json: schema: - $ref: '#/components/schemas/CustomerBlockedListResponse' + $ref: '#/components/schemas/UserGetResponse' '400': $ref: '#/components/responses/BadResponse' '401': $ref: '#/components/responses/UnauthorizedResponse' '403': $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' security: [] - '/customer/{customerId}/blocked/range': + '/user/{username}/username-taken': get: parameters: - - name: customerId + - name: username in: path - description: customerId for the customer + description: username required: true schema: type: string - - name: start - in: query - description: start of date + tags: + - User + operationId: userUsernameTaken + summary: GET check if username is taken + description: This endpoint return false or true + responses: + '200': + description: Response with payload + content: + application/json: + schema: + $ref: '#/components/schemas/UserUsernameTakenResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + security: [] + '/user/{username}/products': + get: + parameters: + - name: username + in: path + description: username is needed required: true schema: type: string - - name: end + - name: scheduleId in: query - description: end of date + description: scheduleId is optional + schema: + type: string + tags: + - UserProduct + operationId: userProductsListBySchedule + summary: GET Get products for user + description: This endpoint get products for user (across all schedules or one scheduleId) + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/UserProductsListByScheduleResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + security: [] + '/user/{username}/products/{productHandle}': + get: + parameters: + - name: username + in: path + required: true + schema: + type: string + - name: productHandle + in: path required: true schema: type: string tags: - - CustomerBlocked - operationId: customerBlockedRange - summary: GET Get all blocked documents for customer - description: This endpoint get all blocked documents + - UserProduct + operationId: UserProductGet + summary: GET Get product that exist in one of the schedules for customer + description: This endpoint get product for customer responses: '200': description: Response content: application/json: schema: - $ref: '#/components/schemas/CustomerBlockedRangeResponse' + $ref: '#/components/schemas/UserProductsGetResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + security: [] + '/user/{username}/products/location/{locationId}': + post: + parameters: + - name: username + in: path + description: username is needed + required: true + schema: + type: string + - name: locationId + in: path + description: locationId is nedded + required: true + schema: + type: string + tags: + - UserProduct + operationId: userProductsGetProducts + summary: GET Get products for user + description: This endpoint get products from one schedule by location + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UserProductsGetProductsBody' + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/UserProductsGetProductsResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + security: [] + '/user/{username}/product/{productHandle}/location/{locationId}': + get: + parameters: + - name: username + in: path + description: username is needed + required: true + schema: + type: string + - name: productHandle + in: path + description: productHandle is nedded + required: true + schema: + type: string + - name: locationId + in: path + description: locationId is nedded + required: true + schema: + type: string + tags: + - UserProduct + operationId: userProductsListByLocation + summary: GET Get products for user + description: This endpoint is intended to be used when we need to fetch related products from the same schedule and same location. + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/UserProductsListByLocationResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + security: [] + '/user/{username}/schedule/get-by-product-id/{productHandle}': + get: + parameters: + - name: username + in: path + description: username + required: true + schema: + type: string + - name: productHandle + in: path + description: productHandle + required: true + schema: + type: string + tags: + - UserSchedule + operationId: userScheduleGetByProduct + summary: GET Get user schedule + description: 'This endpoint should retrieve a schedule and locations belonging to a specific productHandle, along with the product.' + responses: + '200': + description: Response with payload + content: + application/json: + schema: + $ref: '#/components/schemas/UserScheduleGetByProductIdResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + security: [] + '/user/{username}/schedule/{scheduleId}/location/{locationId}': + get: + parameters: + - name: username + in: path + description: username + required: true + schema: + type: string + - name: scheduleId + in: path + description: schedule Id + required: true + schema: + type: string + - name: locationId + in: path + description: location id + required: true + schema: + type: string + tags: + - UserSchedule + operationId: userScheduleGetByLocation + summary: GET Get user schedule + description: This endpoint should retrieve a schedule with products that only belong to a specific locationId. + responses: + '200': + description: Response with payload + content: + application/json: + schema: + $ref: '#/components/schemas/UserScheduleGetByLocationResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + security: [] + '/user/{username}/schedules/locations': + get: + parameters: + - name: username + in: path + description: username is needed + required: true + schema: + type: string + tags: + - UserSchedule + operationId: userSchedulesListLocations + summary: GET Get schedules for user + description: This endpoint should return all locations present in all schedules for specific user + responses: + '200': + description: Response + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + example: true + payload: + type: array + items: + $ref: '#/components/schemas/UserScheduleWithLocations' + required: + - success + - payload + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + security: [] + /users: + parameters: + - name: nextCursor + in: query + description: nextCursor + schema: + type: string + - name: limit + in: query + description: limit items (default 10) + schema: + type: string + - name: profession + in: query + description: profession + schema: + type: string + - name: specialties + in: query + description: specialties + schema: + type: array + items: + type: string + - name: sortOrder + in: query + description: asc or desc + schema: + type: string + get: + tags: + - User + operationId: usersList + summary: GET Get all users + description: This endpoint get all users + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/UsersListResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + security: [] + /users/professions: + get: + tags: + - User + operationId: usersProfessions + summary: GET Get all users professions with total count + description: This endpoint get all users professions + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/UsersProfessionsResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + security: [] + /users/specialties: + get: + parameters: + - name: profession + in: query + description: profession + schema: + type: string + tags: + - User + operationId: usersSpecialties + summary: GET Get all users specialties with total count + description: This endpoint get all users specialties + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/UsersSpecialtiesResponse' + '400': + $ref: '#/components/responses/BadResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + security: [] + /users/top: + parameters: + - name: limit + in: query + description: limit items (default 5) + schema: + type: string + - name: page + in: query + description: page + schema: + type: string + get: + tags: + - User + operationId: usersTop + summary: GET Get all users grouped by professions + description: This endpoint get all users group by professions + responses: + '200': + description: Response + content: + application/json: + schema: + $ref: '#/components/schemas/UsersTopResponse' '400': $ref: '#/components/responses/BadResponse' '401': diff --git a/package-lock.json b/package-lock.json index 9c16d244..d1bd47a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,6 +53,7 @@ "isbot": "^3.6.6", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-imask": "^7.5.0", "react-infinite-scroll-component": "^6.1.0", "uuid": "^9.0.1", "zod": "^3.21.4" @@ -1509,6 +1510,18 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/runtime-corejs3": { + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.24.1.tgz", + "integrity": "sha512-T9ko/35G+Bkl+win48GduaPlhSlOjjE5s1TeiEcD+QpxlLQnoEfb/nO/T+TQqkm+ipFwORn+rB8w14iJ/uD0bg==", + "dependencies": { + "core-js-pure": "^3.30.2", + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/template": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", @@ -9882,6 +9895,16 @@ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", "devOptional": true }, + "node_modules/core-js-pure": { + "version": "3.36.1", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.36.1.tgz", + "integrity": "sha512-NXCvHvSVYSrewP0L5OhltzXeWFJLo2AL2TYnj6iLV3Bw8mM62wAQMNgUCRI6EBu6hVVpbCxmOPlxh1Ikw2PfUA==", + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -13621,6 +13644,17 @@ "node": ">= 4" } }, + "node_modules/imask": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/imask/-/imask-7.5.0.tgz", + "integrity": "sha512-eoTEnw67KAamB1zsiYtU35s0Fj1XYZ8mN2q3ZDGO4ot4FtPmBpw9S6kOTj0kaOILdsEA6ZhNtH2TAMXe/NChmQ==", + "dependencies": { + "@babel/runtime-corejs3": "^7.23.9" + }, + "engines": { + "npm": ">=4.0.0" + } + }, "node_modules/immer": { "version": "9.0.21", "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz", @@ -21938,6 +21972,21 @@ "react": "^18.2.0" } }, + "node_modules/react-imask": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/react-imask/-/react-imask-7.5.0.tgz", + "integrity": "sha512-yWExhHphDmNaHvmOsYR+5QcludeBdYk6bXyo8kouIJFAub5sF+O0kLPVupg2yhd7EfTqjLswFZ/tqY1AhKnd9Q==", + "dependencies": { + "imask": "^7.5.0", + "prop-types": "^15.8.1" + }, + "engines": { + "npm": ">=4.0.0" + }, + "peerDependencies": { + "react": ">=0.14.0" + } + }, "node_modules/react-infinite-scroll-component": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/react-infinite-scroll-component/-/react-infinite-scroll-component-6.1.0.tgz", diff --git a/package.json b/package.json index fd6af839..1d93f30a 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "isbot": "^3.6.6", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-imask": "^7.5.0", "react-infinite-scroll-component": "^6.1.0", "uuid": "^9.0.1", "zod": "^3.21.4"