@connect-plus-online/ogabai-integrations 0.0.80 → 0.0.82
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 +154 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +64 -2
- package/dist/index.d.ts +64 -2
- package/dist/index.esm.js +154 -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,140 @@ 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
|
+
list: {
|
|
1910
|
+
operation: "query",
|
|
1911
|
+
name: "getCustomers",
|
|
1912
|
+
variables: "($limit: Int!, $skip: Int!, $search: String, $customer: CustomerInput, $customerIds: [String])",
|
|
1913
|
+
field: "(limit: $limit, skip: $skip, search: $search, customer: $customer, customerIds: $customerIds)"
|
|
1914
|
+
},
|
|
1915
|
+
create: {
|
|
1916
|
+
operation: "mutation",
|
|
1917
|
+
name: "createCustomer",
|
|
1918
|
+
variables: "($customer: CustomerInput!)",
|
|
1919
|
+
field: "(customer: $customer)"
|
|
1920
|
+
},
|
|
1921
|
+
update: {
|
|
1922
|
+
operation: "mutation",
|
|
1923
|
+
name: "updateCustomer",
|
|
1924
|
+
variables: "($customerId: String!, $customer: CustomerInput!)",
|
|
1925
|
+
field: "(customerId: $customerId, customer: $customer)"
|
|
1926
|
+
},
|
|
1927
|
+
delete: {
|
|
1928
|
+
operation: "mutation",
|
|
1929
|
+
name: "deleteCustomer",
|
|
1930
|
+
variables: "($customerId: String!)",
|
|
1931
|
+
field: "(customerId: $customerId)"
|
|
1932
|
+
},
|
|
1933
|
+
// important to have this separate from the general list query to avoid confusion and potential bugs with the storeId variable
|
|
1934
|
+
listByStoreId: {
|
|
1935
|
+
operation: "query",
|
|
1936
|
+
name: "getCustomersByStoreId",
|
|
1937
|
+
variables: "($limit: Int!, $skip: Int!, $storeId: String!, $search: String, $customer: CustomerInput, $customerIds: [String])",
|
|
1938
|
+
field: "(limit: $limit, skip: $skip, storeId: $storeId, search: $search, customer: $customer, customerIds: $customerIds)"
|
|
1939
|
+
},
|
|
1940
|
+
deleteFromStore: {
|
|
1941
|
+
operation: "mutation",
|
|
1942
|
+
name: "deleteCustomerFromStore",
|
|
1943
|
+
variables: "($customerId: String!, $storeId: String!)",
|
|
1944
|
+
field: "(customerId: $customerId, storeId: $storeId)"
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
|
|
1948
|
+
// src/services/user/customer.service.ts
|
|
1949
|
+
var createCustomerService = (client) => ({
|
|
1950
|
+
createCustomer: createOperationExecutor(
|
|
1951
|
+
client,
|
|
1952
|
+
"createCustomer",
|
|
1953
|
+
{
|
|
1954
|
+
schema: buildSchema(customerSchema.create),
|
|
1955
|
+
defaultRootFields: customerIntegration.create.responseFields,
|
|
1956
|
+
defaultNestedFields: customerIntegration.create.nestedFields
|
|
1957
|
+
}
|
|
1958
|
+
),
|
|
1959
|
+
updateCustomer: createOperationExecutor(
|
|
1960
|
+
client,
|
|
1961
|
+
"updateCustomer",
|
|
1962
|
+
{
|
|
1963
|
+
schema: buildSchema(customerSchema.update),
|
|
1964
|
+
defaultRootFields: customerIntegration.update.responseFields,
|
|
1965
|
+
defaultNestedFields: customerIntegration.update.nestedFields
|
|
1966
|
+
}
|
|
1967
|
+
),
|
|
1968
|
+
getCustomer: createOperationExecutor(
|
|
1969
|
+
client,
|
|
1970
|
+
"getCustomer",
|
|
1971
|
+
{
|
|
1972
|
+
schema: buildSchema(customerSchema.get),
|
|
1973
|
+
defaultRootFields: customerIntegration.get.responseFields,
|
|
1974
|
+
defaultNestedFields: customerIntegration.get.nestedFields
|
|
1975
|
+
}
|
|
1976
|
+
),
|
|
1977
|
+
// only for admin
|
|
1978
|
+
deleteCustomer: createOperationExecutor(
|
|
1979
|
+
client,
|
|
1980
|
+
"deleteCustomer",
|
|
1981
|
+
{
|
|
1982
|
+
schema: buildSchema(customerSchema.delete),
|
|
1983
|
+
defaultRootFields: customerDeleteIntegration.responseFields,
|
|
1984
|
+
defaultNestedFields: {}
|
|
1985
|
+
}
|
|
1986
|
+
),
|
|
1987
|
+
// only admin
|
|
1988
|
+
getCustomers: createOperationExecutor(
|
|
1989
|
+
client,
|
|
1990
|
+
"getCustomers",
|
|
1991
|
+
{
|
|
1992
|
+
schema: buildSchema(customerSchema.list),
|
|
1993
|
+
defaultRootFields: [...customerListIntegration.responseFields],
|
|
1994
|
+
defaultNestedFields: customerListIntegration.nestedFields
|
|
1995
|
+
}
|
|
1996
|
+
),
|
|
1997
|
+
getCustomersByStoreId: createOperationExecutor(
|
|
1998
|
+
client,
|
|
1999
|
+
"getCustomersByStoreId",
|
|
2000
|
+
{
|
|
2001
|
+
schema: buildSchema(customerSchema.listByStoreId),
|
|
2002
|
+
defaultRootFields: [...customerListIntegration.responseFields],
|
|
2003
|
+
defaultNestedFields: customerListIntegration.nestedFields
|
|
2004
|
+
}
|
|
2005
|
+
),
|
|
2006
|
+
deleteFromStore: createOperationExecutor(
|
|
2007
|
+
client,
|
|
2008
|
+
"deleteFromStore",
|
|
2009
|
+
{
|
|
2010
|
+
schema: buildSchema(customerSchema.deleteFromStore),
|
|
2011
|
+
defaultRootFields: [...customerDeleteIntegration.responseFields, "storeId"],
|
|
2012
|
+
defaultNestedFields: {}
|
|
2013
|
+
}
|
|
2014
|
+
)
|
|
2015
|
+
});
|
|
2016
|
+
|
|
1866
2017
|
// src/services/inventory/types/product.type.ts
|
|
1867
2018
|
var getCustomerProductCountsByIdsResponse = [
|
|
1868
2019
|
"customersProductCounts"
|
|
@@ -3070,7 +3221,8 @@ var transactionQuery = [
|
|
|
3070
3221
|
"storeId",
|
|
3071
3222
|
"to",
|
|
3072
3223
|
"toWallet",
|
|
3073
|
-
"txStatus"
|
|
3224
|
+
"txStatus",
|
|
3225
|
+
"transactionType"
|
|
3074
3226
|
];
|
|
3075
3227
|
var orderQuery = [
|
|
3076
3228
|
"_id",
|
|
@@ -3357,6 +3509,7 @@ exports.addTransactionResponse = addTransactionResponse;
|
|
|
3357
3509
|
exports.addTransactionResponseNestedFields = addTransactionResponseNestedFields;
|
|
3358
3510
|
exports.compose = compose;
|
|
3359
3511
|
exports.createAuthService = createAuthService;
|
|
3512
|
+
exports.createCustomerService = createCustomerService;
|
|
3360
3513
|
exports.createOrderService = createOrderService;
|
|
3361
3514
|
exports.createPackageService = createPackageService;
|
|
3362
3515
|
exports.createPaystackService = createPaystackService;
|