@connect-plus-online/ogabai-integrations 0.0.81 → 0.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +180 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +66 -1
- package/dist/index.d.ts +66 -1
- package/dist/index.esm.js +180 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -278,6 +278,23 @@ var userSchema = {
|
|
|
278
278
|
var user_schema_default = userSchema;
|
|
279
279
|
|
|
280
280
|
// src/services/user/user.entity.ts
|
|
281
|
+
var customerQuery = [
|
|
282
|
+
"createdAt",
|
|
283
|
+
"email",
|
|
284
|
+
"id",
|
|
285
|
+
"name",
|
|
286
|
+
"phone",
|
|
287
|
+
"customerStoreBalance",
|
|
288
|
+
"storeIds"
|
|
289
|
+
];
|
|
290
|
+
var customerStoreBalanceQuery = [
|
|
291
|
+
"balance",
|
|
292
|
+
"createdAt",
|
|
293
|
+
"customerId",
|
|
294
|
+
"id",
|
|
295
|
+
"owed",
|
|
296
|
+
"storeId"
|
|
297
|
+
];
|
|
281
298
|
var privilegeQuery = [
|
|
282
299
|
"actions",
|
|
283
300
|
"feature"
|
|
@@ -1863,6 +1880,139 @@ var createUserRoleService = (client) => ({
|
|
|
1863
1880
|
)
|
|
1864
1881
|
});
|
|
1865
1882
|
|
|
1883
|
+
// src/services/user/types/customer.type.ts
|
|
1884
|
+
var ENTITY7 = "customer";
|
|
1885
|
+
var customerIntegration = createStandardEntityIntegration({
|
|
1886
|
+
key: ENTITY7,
|
|
1887
|
+
fields: customerQuery,
|
|
1888
|
+
nested: {
|
|
1889
|
+
customerStoreBalance: customerStoreBalanceQuery
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
var customerListIntegration = createListIntegration({
|
|
1893
|
+
key: "customers",
|
|
1894
|
+
fields: customerQuery,
|
|
1895
|
+
nested: {
|
|
1896
|
+
customerStoreBalance: customerStoreBalanceQuery
|
|
1897
|
+
}
|
|
1898
|
+
});
|
|
1899
|
+
var customerDeleteIntegration = createDeleteIntegration(ENTITY7);
|
|
1900
|
+
|
|
1901
|
+
// src/services/user/schemas/customer.schema.ts
|
|
1902
|
+
var customerSchema = {
|
|
1903
|
+
get: {
|
|
1904
|
+
operation: "query",
|
|
1905
|
+
name: "getCustomer",
|
|
1906
|
+
variables: "($customer: CustomerInput!)",
|
|
1907
|
+
field: "(customer: $customer)"
|
|
1908
|
+
},
|
|
1909
|
+
create: {
|
|
1910
|
+
operation: "mutation",
|
|
1911
|
+
name: "createCustomer",
|
|
1912
|
+
variables: "($customer: CustomerInput!)",
|
|
1913
|
+
field: "(customer: $customer)"
|
|
1914
|
+
},
|
|
1915
|
+
update: {
|
|
1916
|
+
operation: "mutation",
|
|
1917
|
+
name: "updateCustomer",
|
|
1918
|
+
variables: "($customerId: String!, $customer: CustomerInput!)",
|
|
1919
|
+
field: "(customerId: $customerId, customer: $customer)"
|
|
1920
|
+
},
|
|
1921
|
+
delete: {
|
|
1922
|
+
operation: "mutation",
|
|
1923
|
+
name: "deleteCustomer",
|
|
1924
|
+
variables: "($customerId: String!)",
|
|
1925
|
+
field: "(customerId: $customerId)"
|
|
1926
|
+
},
|
|
1927
|
+
// important to have this separate from the general list query to avoid confusion and potential bugs with the storeId variable
|
|
1928
|
+
listByStoreId: {
|
|
1929
|
+
operation: "query",
|
|
1930
|
+
name: "getCustomersByStoreId",
|
|
1931
|
+
variables: "($limit: Int!, $skip: Int!, $storeId: String!, $search: String, $customer: CustomerInput, $customerIds: [String])",
|
|
1932
|
+
field: "(limit: $limit, skip: $skip, storeId: $storeId, search: $search, customer: $customer, customerIds: $customerIds)"
|
|
1933
|
+
},
|
|
1934
|
+
deleteFromStore: {
|
|
1935
|
+
operation: "mutation",
|
|
1936
|
+
name: "deleteCustomerFromStore",
|
|
1937
|
+
variables: "($customerId: String!, $storeId: String!)",
|
|
1938
|
+
field: "(customerId: $customerId, storeId: $storeId)"
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
|
|
1942
|
+
// src/services/user/customer.service.ts
|
|
1943
|
+
var createCustomerService = (client) => ({
|
|
1944
|
+
createCustomer: createOperationExecutor(
|
|
1945
|
+
client,
|
|
1946
|
+
"createCustomer",
|
|
1947
|
+
{
|
|
1948
|
+
schema: buildSchema(customerSchema.create),
|
|
1949
|
+
defaultRootFields: customerIntegration.create.responseFields,
|
|
1950
|
+
defaultNestedFields: customerIntegration.create.nestedFields
|
|
1951
|
+
}
|
|
1952
|
+
),
|
|
1953
|
+
updateCustomer: createOperationExecutor(
|
|
1954
|
+
client,
|
|
1955
|
+
"updateCustomer",
|
|
1956
|
+
{
|
|
1957
|
+
schema: buildSchema(customerSchema.update),
|
|
1958
|
+
defaultRootFields: customerIntegration.update.responseFields,
|
|
1959
|
+
defaultNestedFields: customerIntegration.update.nestedFields
|
|
1960
|
+
}
|
|
1961
|
+
),
|
|
1962
|
+
getCustomer: createOperationExecutor(
|
|
1963
|
+
client,
|
|
1964
|
+
"getCustomer",
|
|
1965
|
+
{
|
|
1966
|
+
schema: buildSchema(customerSchema.get),
|
|
1967
|
+
defaultRootFields: customerIntegration.get.responseFields,
|
|
1968
|
+
defaultNestedFields: customerIntegration.get.nestedFields
|
|
1969
|
+
}
|
|
1970
|
+
),
|
|
1971
|
+
// only for admin
|
|
1972
|
+
deleteCustomer: createOperationExecutor(
|
|
1973
|
+
client,
|
|
1974
|
+
"deleteCustomer",
|
|
1975
|
+
{
|
|
1976
|
+
schema: buildSchema(customerSchema.delete),
|
|
1977
|
+
defaultRootFields: customerDeleteIntegration.responseFields,
|
|
1978
|
+
defaultNestedFields: {}
|
|
1979
|
+
}
|
|
1980
|
+
),
|
|
1981
|
+
// only admin
|
|
1982
|
+
// getCustomers: createOperationExecutor<
|
|
1983
|
+
// "getCustomers",
|
|
1984
|
+
// CustomerCRUD["ListRequest"],
|
|
1985
|
+
// CustomerCRUD["ListResponse"],
|
|
1986
|
+
// typeof customerListIntegration.nestedFields
|
|
1987
|
+
// >(
|
|
1988
|
+
// client,
|
|
1989
|
+
// "getCustomers",
|
|
1990
|
+
// {
|
|
1991
|
+
// schema: buildSchema(customerSchema.list),
|
|
1992
|
+
// defaultRootFields: [...customerListIntegration.responseFields],
|
|
1993
|
+
// defaultNestedFields: customerListIntegration.nestedFields,
|
|
1994
|
+
// }
|
|
1995
|
+
// ),
|
|
1996
|
+
getCustomersByStoreId: createOperationExecutor(
|
|
1997
|
+
client,
|
|
1998
|
+
"getCustomersByStoreId",
|
|
1999
|
+
{
|
|
2000
|
+
schema: buildSchema(customerSchema.listByStoreId),
|
|
2001
|
+
defaultRootFields: [...customerListIntegration.responseFields],
|
|
2002
|
+
defaultNestedFields: customerListIntegration.nestedFields
|
|
2003
|
+
}
|
|
2004
|
+
),
|
|
2005
|
+
deleteFromStore: createOperationExecutor(
|
|
2006
|
+
client,
|
|
2007
|
+
"deleteFromStore",
|
|
2008
|
+
{
|
|
2009
|
+
schema: buildSchema(customerSchema.deleteFromStore),
|
|
2010
|
+
defaultRootFields: [...customerDeleteIntegration.responseFields, "storeId"],
|
|
2011
|
+
defaultNestedFields: {}
|
|
2012
|
+
}
|
|
2013
|
+
)
|
|
2014
|
+
});
|
|
2015
|
+
|
|
1866
2016
|
// src/services/inventory/types/product.type.ts
|
|
1867
2017
|
var getCustomerProductCountsByIdsResponse = [
|
|
1868
2018
|
"customersProductCounts"
|
|
@@ -3070,7 +3220,9 @@ var transactionQuery = [
|
|
|
3070
3220
|
"storeId",
|
|
3071
3221
|
"to",
|
|
3072
3222
|
"toWallet",
|
|
3073
|
-
"txStatus"
|
|
3223
|
+
"txStatus",
|
|
3224
|
+
"customerId",
|
|
3225
|
+
"transactionType"
|
|
3074
3226
|
];
|
|
3075
3227
|
var orderQuery = [
|
|
3076
3228
|
"_id",
|
|
@@ -3293,6 +3445,32 @@ var createTransactionService = (client) => ({
|
|
|
3293
3445
|
);
|
|
3294
3446
|
return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
|
|
3295
3447
|
},
|
|
3448
|
+
async addCustomerDeposit(input, fetchFields, option) {
|
|
3449
|
+
return this.addTransaction(
|
|
3450
|
+
{
|
|
3451
|
+
transaction: {
|
|
3452
|
+
...input,
|
|
3453
|
+
transactionType: "customerDeposit",
|
|
3454
|
+
platform: "pos"
|
|
3455
|
+
}
|
|
3456
|
+
},
|
|
3457
|
+
fetchFields,
|
|
3458
|
+
option
|
|
3459
|
+
);
|
|
3460
|
+
},
|
|
3461
|
+
async addCustomerRefund(input, fetchFields, option) {
|
|
3462
|
+
return this.addTransaction(
|
|
3463
|
+
{
|
|
3464
|
+
transaction: {
|
|
3465
|
+
...input,
|
|
3466
|
+
transactionType: "customerRefund",
|
|
3467
|
+
platform: "pos"
|
|
3468
|
+
}
|
|
3469
|
+
},
|
|
3470
|
+
fetchFields,
|
|
3471
|
+
option
|
|
3472
|
+
);
|
|
3473
|
+
},
|
|
3296
3474
|
async getTransaction(input, fetchFields, option) {
|
|
3297
3475
|
var _a, _b, _c, _d;
|
|
3298
3476
|
const res = await client.request(
|
|
@@ -3357,6 +3535,7 @@ exports.addTransactionResponse = addTransactionResponse;
|
|
|
3357
3535
|
exports.addTransactionResponseNestedFields = addTransactionResponseNestedFields;
|
|
3358
3536
|
exports.compose = compose;
|
|
3359
3537
|
exports.createAuthService = createAuthService;
|
|
3538
|
+
exports.createCustomerService = createCustomerService;
|
|
3360
3539
|
exports.createOrderService = createOrderService;
|
|
3361
3540
|
exports.createPackageService = createPackageService;
|
|
3362
3541
|
exports.createPaystackService = createPaystackService;
|