shopeasy-sdk 1.0.0
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/README.md +383 -0
- package/dist/functions/api/config.cjs +81 -0
- package/dist/functions/api/config.mjs +71 -0
- package/dist/functions/api/index.cjs +35 -0
- package/dist/functions/api/index.mjs +33 -0
- package/dist/functions/api/services/carts.service.cjs +64 -0
- package/dist/functions/api/services/carts.service.mjs +62 -0
- package/dist/functions/api/services/catalog.service.cjs +60 -0
- package/dist/functions/api/services/catalog.service.mjs +58 -0
- package/dist/functions/api/services/configs.service.cjs +46 -0
- package/dist/functions/api/services/configs.service.mjs +44 -0
- package/dist/functions/api/services/coupons.service.cjs +54 -0
- package/dist/functions/api/services/coupons.service.mjs +52 -0
- package/dist/functions/api/services/customer.service.cjs +65 -0
- package/dist/functions/api/services/customer.service.mjs +63 -0
- package/dist/functions/api/services/images.service.cjs +17 -0
- package/dist/functions/api/services/images.service.mjs +15 -0
- package/dist/functions/api/services/orders.service.cjs +36 -0
- package/dist/functions/api/services/orders.service.mjs +34 -0
- package/dist/functions/api/services/payment.service.cjs +26 -0
- package/dist/functions/api/services/payment.service.mjs +24 -0
- package/dist/functions/api/services/plans.service.cjs +67 -0
- package/dist/functions/api/services/plans.service.mjs +65 -0
- package/dist/functions/api/services/products.service.cjs +104 -0
- package/dist/functions/api/services/products.service.mjs +102 -0
- package/dist/functions/api/services/sales.service.cjs +29 -0
- package/dist/functions/api/services/sales.service.mjs +27 -0
- package/dist/functions/api/services/token.service.cjs +17 -0
- package/dist/functions/api/services/token.service.mjs +15 -0
- package/dist/functions/api/services/users.service.cjs +13 -0
- package/dist/functions/api/services/users.service.mjs +11 -0
- package/dist/functions/api/services/wallet.service.cjs +33 -0
- package/dist/functions/api/services/wallet.service.mjs +31 -0
- package/dist/functions/utils/cart.cjs +53 -0
- package/dist/functions/utils/cart.mjs +47 -0
- package/dist/functions/utils/formarts.cjs +30 -0
- package/dist/functions/utils/formarts.mjs +25 -0
- package/dist/functions/utils/permission.cjs +31 -0
- package/dist/functions/utils/permission.mjs +29 -0
- package/dist/index.cjs +45 -0
- package/dist/index.d.cts +766 -0
- package/dist/index.d.mts +766 -0
- package/dist/index.d.ts +766 -0
- package/dist/index.mjs +32 -0
- package/dist/tools/pix.cjs +108 -0
- package/dist/tools/pix.mjs +101 -0
- package/package.json +47 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { api } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
let cartService$1 = class cartService {
|
|
4
|
+
draft = {
|
|
5
|
+
get: async (cardId) => {
|
|
6
|
+
const { data } = await api.get(`/carts/draft/${cardId}`);
|
|
7
|
+
return data;
|
|
8
|
+
},
|
|
9
|
+
set: async ({
|
|
10
|
+
cartId,
|
|
11
|
+
update
|
|
12
|
+
}) => {
|
|
13
|
+
const { data } = await api.patch(`/carts/draft/${cartId}`, update);
|
|
14
|
+
return data;
|
|
15
|
+
},
|
|
16
|
+
delete: async (cartId) => {
|
|
17
|
+
await api.request({
|
|
18
|
+
method: "DELETE",
|
|
19
|
+
url: `/carts/draft/${cartId}`,
|
|
20
|
+
data: {}
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
async create(args) {
|
|
26
|
+
const { data } = await api.post("/carts", args);
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
async get(args) {
|
|
30
|
+
const { data } = await api.get(
|
|
31
|
+
`/carts/by-userid/${args.guildId}/${args.userId}`
|
|
32
|
+
);
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
async getById(cartId) {
|
|
36
|
+
const { data } = await api.get(`/carts/${cartId}`);
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
async getAllByGuild(guildId) {
|
|
40
|
+
const { data } = await api.get(`/carts/by-guild/${guildId}`);
|
|
41
|
+
return data.data ?? data;
|
|
42
|
+
}
|
|
43
|
+
async update(args) {
|
|
44
|
+
const { data } = await api.patch(`/carts/${args.id}`, args.data);
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
async expires(botClient) {
|
|
48
|
+
const { data } = await api.get(`/carts/expires/${botClient}`);
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
async count(guildId) {
|
|
52
|
+
const { data } = await api.get(`/carts/count/${guildId}`);
|
|
53
|
+
return data ?? 0;
|
|
54
|
+
}
|
|
55
|
+
async delete(cartId) {
|
|
56
|
+
await api.request({ method: "DELETE", url: `/carts/${cartId}`, data: {} });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const cartService = new cartService$1();
|
|
61
|
+
|
|
62
|
+
export { cartService as default };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('../config.cjs');
|
|
4
|
+
|
|
5
|
+
class CatalogService {
|
|
6
|
+
async setDraft(args) {
|
|
7
|
+
const { data } = await config.api.put(
|
|
8
|
+
`/catalogs/draft/${args.id}/${args.id}`,
|
|
9
|
+
args.data
|
|
10
|
+
);
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
async getDraft(args) {
|
|
14
|
+
const { data } = await config.api.get(
|
|
15
|
+
`/catalogs/draft/${args.id}/${args.id}`
|
|
16
|
+
);
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
async getByReference(reference, guildId) {
|
|
20
|
+
const { data } = await config.api.get(
|
|
21
|
+
`/catalogs/by-reference/${reference}/${guildId}`
|
|
22
|
+
);
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
async getById(id) {
|
|
26
|
+
const { data } = await config.api.get(`/catalogs/${id}`);
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
async create(args) {
|
|
30
|
+
const { data } = await config.api.post("/catalogs", args);
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
async getByCaching(id) {
|
|
34
|
+
const { data } = await config.api.get(`/catalogs/caching/${id}`);
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
async getAllByGuild(guildId) {
|
|
38
|
+
const { data } = await config.api.get(`/catalogs/by-guild/${guildId}`);
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
async update(args) {
|
|
42
|
+
const { data } = await config.api.patch(
|
|
43
|
+
`/catalogs/${args.id}`,
|
|
44
|
+
args.data
|
|
45
|
+
);
|
|
46
|
+
const catalog = data;
|
|
47
|
+
return catalog;
|
|
48
|
+
}
|
|
49
|
+
async count(guildId) {
|
|
50
|
+
const { data } = await config.api.get(`/catalogs/count/${guildId}`);
|
|
51
|
+
return data ?? 0;
|
|
52
|
+
}
|
|
53
|
+
async delete(id) {
|
|
54
|
+
const { data } = await config.api.request({ method: "DELETE", url: `/catalogs/${id}`, data: {} });
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const CatalogService$1 = new CatalogService();
|
|
59
|
+
|
|
60
|
+
module.exports = CatalogService$1;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { api } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
let CatalogService$1 = class CatalogService {
|
|
4
|
+
async setDraft(args) {
|
|
5
|
+
const { data } = await api.put(
|
|
6
|
+
`/catalogs/draft/${args.id}/${args.id}`,
|
|
7
|
+
args.data
|
|
8
|
+
);
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
async getDraft(args) {
|
|
12
|
+
const { data } = await api.get(
|
|
13
|
+
`/catalogs/draft/${args.id}/${args.id}`
|
|
14
|
+
);
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
async getByReference(reference, guildId) {
|
|
18
|
+
const { data } = await api.get(
|
|
19
|
+
`/catalogs/by-reference/${reference}/${guildId}`
|
|
20
|
+
);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
async getById(id) {
|
|
24
|
+
const { data } = await api.get(`/catalogs/${id}`);
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
async create(args) {
|
|
28
|
+
const { data } = await api.post("/catalogs", args);
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
async getByCaching(id) {
|
|
32
|
+
const { data } = await api.get(`/catalogs/caching/${id}`);
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
async getAllByGuild(guildId) {
|
|
36
|
+
const { data } = await api.get(`/catalogs/by-guild/${guildId}`);
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
async update(args) {
|
|
40
|
+
const { data } = await api.patch(
|
|
41
|
+
`/catalogs/${args.id}`,
|
|
42
|
+
args.data
|
|
43
|
+
);
|
|
44
|
+
const catalog = data;
|
|
45
|
+
return catalog;
|
|
46
|
+
}
|
|
47
|
+
async count(guildId) {
|
|
48
|
+
const { data } = await api.get(`/catalogs/count/${guildId}`);
|
|
49
|
+
return data ?? 0;
|
|
50
|
+
}
|
|
51
|
+
async delete(id) {
|
|
52
|
+
const { data } = await api.request({ method: "DELETE", url: `/catalogs/${id}`, data: {} });
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const CatalogService = new CatalogService$1();
|
|
57
|
+
|
|
58
|
+
export { CatalogService as default };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('../config.cjs');
|
|
4
|
+
|
|
5
|
+
class ConfigsService {
|
|
6
|
+
async getByGuild(guildId) {
|
|
7
|
+
const { data } = await config.api.get(`/configs/${guildId}`);
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
async setDraft(args) {
|
|
11
|
+
const { data } = await config.api.put(
|
|
12
|
+
`/configs/draft/${args.guildId}/${args.userId}`,
|
|
13
|
+
args.data
|
|
14
|
+
);
|
|
15
|
+
if (Object.keys(data).length === 0) return null;
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
async delDraft(args) {
|
|
19
|
+
const { data } = await config.api.request({
|
|
20
|
+
method: "DELETE",
|
|
21
|
+
url: `/configs/draft/${args.guildId}/${args.userId}`,
|
|
22
|
+
data: {}
|
|
23
|
+
});
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
async getDraft(args) {
|
|
27
|
+
const { data } = await config.api.get(
|
|
28
|
+
`/configs/draft/${args.guildId}/${args.userId}`
|
|
29
|
+
);
|
|
30
|
+
if (data && Object.keys(data).length === 0) return null;
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
async update(args) {
|
|
34
|
+
const { data } = await config.api.patch(
|
|
35
|
+
`/configs/${args.guildId}`,
|
|
36
|
+
args.data
|
|
37
|
+
);
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
async getByCaching(_guildId) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const ConfigsService$1 = new ConfigsService();
|
|
45
|
+
|
|
46
|
+
module.exports = ConfigsService$1;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { api } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
let ConfigsService$1 = class ConfigsService {
|
|
4
|
+
async getByGuild(guildId) {
|
|
5
|
+
const { data } = await api.get(`/configs/${guildId}`);
|
|
6
|
+
return data;
|
|
7
|
+
}
|
|
8
|
+
async setDraft(args) {
|
|
9
|
+
const { data } = await api.put(
|
|
10
|
+
`/configs/draft/${args.guildId}/${args.userId}`,
|
|
11
|
+
args.data
|
|
12
|
+
);
|
|
13
|
+
if (Object.keys(data).length === 0) return null;
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
async delDraft(args) {
|
|
17
|
+
const { data } = await api.request({
|
|
18
|
+
method: "DELETE",
|
|
19
|
+
url: `/configs/draft/${args.guildId}/${args.userId}`,
|
|
20
|
+
data: {}
|
|
21
|
+
});
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
async getDraft(args) {
|
|
25
|
+
const { data } = await api.get(
|
|
26
|
+
`/configs/draft/${args.guildId}/${args.userId}`
|
|
27
|
+
);
|
|
28
|
+
if (data && Object.keys(data).length === 0) return null;
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
async update(args) {
|
|
32
|
+
const { data } = await api.patch(
|
|
33
|
+
`/configs/${args.guildId}`,
|
|
34
|
+
args.data
|
|
35
|
+
);
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
async getByCaching(_guildId) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const ConfigsService = new ConfigsService$1();
|
|
43
|
+
|
|
44
|
+
export { ConfigsService as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('../config.cjs');
|
|
4
|
+
|
|
5
|
+
class CouponService {
|
|
6
|
+
async setDraft(args) {
|
|
7
|
+
const { data } = await config.api.put(
|
|
8
|
+
`/coupons/draft/${args.id}/${args.id}`,
|
|
9
|
+
args.data
|
|
10
|
+
);
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
async getDraft(args) {
|
|
14
|
+
const { data } = await config.api.get(
|
|
15
|
+
`/coupons/draft/${args.id}/${args.id}`
|
|
16
|
+
);
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
async existsByCode(code) {
|
|
20
|
+
const { data } = await config.api.get(`/coupons/exists/${code}`);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
async getById(id) {
|
|
24
|
+
const { data } = await config.api.get(`/coupons/${id}`);
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
async create(args) {
|
|
28
|
+
const { data } = await config.api.post("/coupons", args);
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
async getByCaching(id) {
|
|
32
|
+
const { data } = await config.api.get(`/coupons/caching/${id}`);
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
async getAllByGuild(guildId) {
|
|
36
|
+
const { data } = await config.api.get(`/coupons/by-guild/${guildId}`);
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
async update(args) {
|
|
40
|
+
const { data } = await config.api.patch(`/coupons/${args.id}`, args.data);
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
async count(guildId) {
|
|
44
|
+
const { data } = await config.api.get(`/coupons/count/${guildId}`);
|
|
45
|
+
return data ?? 0;
|
|
46
|
+
}
|
|
47
|
+
async delete(id) {
|
|
48
|
+
const { data } = await config.api.delete(`/coupons/${id}`);
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const CouponService$1 = new CouponService();
|
|
53
|
+
|
|
54
|
+
module.exports = CouponService$1;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { api } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
let CouponService$1 = class CouponService {
|
|
4
|
+
async setDraft(args) {
|
|
5
|
+
const { data } = await api.put(
|
|
6
|
+
`/coupons/draft/${args.id}/${args.id}`,
|
|
7
|
+
args.data
|
|
8
|
+
);
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
async getDraft(args) {
|
|
12
|
+
const { data } = await api.get(
|
|
13
|
+
`/coupons/draft/${args.id}/${args.id}`
|
|
14
|
+
);
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
async existsByCode(code) {
|
|
18
|
+
const { data } = await api.get(`/coupons/exists/${code}`);
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
async getById(id) {
|
|
22
|
+
const { data } = await api.get(`/coupons/${id}`);
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
async create(args) {
|
|
26
|
+
const { data } = await api.post("/coupons", args);
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
async getByCaching(id) {
|
|
30
|
+
const { data } = await api.get(`/coupons/caching/${id}`);
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
async getAllByGuild(guildId) {
|
|
34
|
+
const { data } = await api.get(`/coupons/by-guild/${guildId}`);
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
async update(args) {
|
|
38
|
+
const { data } = await api.patch(`/coupons/${args.id}`, args.data);
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
async count(guildId) {
|
|
42
|
+
const { data } = await api.get(`/coupons/count/${guildId}`);
|
|
43
|
+
return data ?? 0;
|
|
44
|
+
}
|
|
45
|
+
async delete(id) {
|
|
46
|
+
const { data } = await api.delete(`/coupons/${id}`);
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const CouponService = new CouponService$1();
|
|
51
|
+
|
|
52
|
+
export { CouponService as default };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('../config.cjs');
|
|
4
|
+
|
|
5
|
+
class CustomerService {
|
|
6
|
+
async setDraft(args) {
|
|
7
|
+
const { data } = await config.api.put(
|
|
8
|
+
`/customers/draft/${args.id}/${args.id}`,
|
|
9
|
+
args.data
|
|
10
|
+
);
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
async getDraft(args) {
|
|
14
|
+
const { data } = await config.api.get(
|
|
15
|
+
`/customers/draft/${args.id}/${args.id}`
|
|
16
|
+
);
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
async existsByReference(_reference) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
async getById(id) {
|
|
23
|
+
const { data } = await config.api.get(`/customers/${id}`);
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
async getByReference(_reference) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
async create(args) {
|
|
30
|
+
const { data } = await config.api.post("/customers", args);
|
|
31
|
+
const customer = data;
|
|
32
|
+
return customer;
|
|
33
|
+
}
|
|
34
|
+
async getByCaching(id) {
|
|
35
|
+
const { data } = await config.api.get(`/customers/caching/${id}`);
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
async getAllByGuild(guildId) {
|
|
39
|
+
const { data } = await config.api.get(
|
|
40
|
+
`/customers/by-guild/${guildId}`
|
|
41
|
+
);
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
async update(args) {
|
|
45
|
+
const { data } = await config.api.patch(
|
|
46
|
+
`/customers/${args.id}`,
|
|
47
|
+
args.data
|
|
48
|
+
);
|
|
49
|
+
const customer = data;
|
|
50
|
+
return customer;
|
|
51
|
+
}
|
|
52
|
+
async count(guildId) {
|
|
53
|
+
const { data } = await config.api.get(
|
|
54
|
+
`/customers/count/${guildId}`
|
|
55
|
+
);
|
|
56
|
+
return data ?? 0;
|
|
57
|
+
}
|
|
58
|
+
async delete(id) {
|
|
59
|
+
const { data } = await config.api.delete(`/customers/${id}`);
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const CustomerService$1 = new CustomerService();
|
|
64
|
+
|
|
65
|
+
module.exports = CustomerService$1;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { api } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
let CustomerService$1 = class CustomerService {
|
|
4
|
+
async setDraft(args) {
|
|
5
|
+
const { data } = await api.put(
|
|
6
|
+
`/customers/draft/${args.id}/${args.id}`,
|
|
7
|
+
args.data
|
|
8
|
+
);
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
async getDraft(args) {
|
|
12
|
+
const { data } = await api.get(
|
|
13
|
+
`/customers/draft/${args.id}/${args.id}`
|
|
14
|
+
);
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
async existsByReference(_reference) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
async getById(id) {
|
|
21
|
+
const { data } = await api.get(`/customers/${id}`);
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
async getByReference(_reference) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
async create(args) {
|
|
28
|
+
const { data } = await api.post("/customers", args);
|
|
29
|
+
const customer = data;
|
|
30
|
+
return customer;
|
|
31
|
+
}
|
|
32
|
+
async getByCaching(id) {
|
|
33
|
+
const { data } = await api.get(`/customers/caching/${id}`);
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
async getAllByGuild(guildId) {
|
|
37
|
+
const { data } = await api.get(
|
|
38
|
+
`/customers/by-guild/${guildId}`
|
|
39
|
+
);
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
async update(args) {
|
|
43
|
+
const { data } = await api.patch(
|
|
44
|
+
`/customers/${args.id}`,
|
|
45
|
+
args.data
|
|
46
|
+
);
|
|
47
|
+
const customer = data;
|
|
48
|
+
return customer;
|
|
49
|
+
}
|
|
50
|
+
async count(guildId) {
|
|
51
|
+
const { data } = await api.get(
|
|
52
|
+
`/customers/count/${guildId}`
|
|
53
|
+
);
|
|
54
|
+
return data ?? 0;
|
|
55
|
+
}
|
|
56
|
+
async delete(id) {
|
|
57
|
+
const { data } = await api.delete(`/customers/${id}`);
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const CustomerService = new CustomerService$1();
|
|
62
|
+
|
|
63
|
+
export { CustomerService as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('../config.cjs');
|
|
4
|
+
|
|
5
|
+
class ImageService {
|
|
6
|
+
async getAll(guildId) {
|
|
7
|
+
const { data } = await config.api.get(`/images/by-guild/${guildId}`);
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
async create(args) {
|
|
11
|
+
const { data } = await config.api.post("/images", args);
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const ImageService$1 = new ImageService();
|
|
16
|
+
|
|
17
|
+
module.exports = ImageService$1;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { api } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
let ImageService$1 = class ImageService {
|
|
4
|
+
async getAll(guildId) {
|
|
5
|
+
const { data } = await api.get(`/images/by-guild/${guildId}`);
|
|
6
|
+
return data;
|
|
7
|
+
}
|
|
8
|
+
async create(args) {
|
|
9
|
+
const { data } = await api.post("/images", args);
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const ImageService = new ImageService$1();
|
|
14
|
+
|
|
15
|
+
export { ImageService as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('../config.cjs');
|
|
4
|
+
|
|
5
|
+
class OrderService {
|
|
6
|
+
async create(args) {
|
|
7
|
+
const { data } = await config.api.post("/orders", args);
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
async get(orderId) {
|
|
11
|
+
const { data } = await config.api.get(`/orders/${orderId}`);
|
|
12
|
+
console.log(data);
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
async getPayment(orderId) {
|
|
16
|
+
const { data } = await config.api.get(`/orders/payment/${orderId}`);
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
async getApprovedUnprocessed(botClient, guildId) {
|
|
20
|
+
const { data } = await config.api.get(`/orders/approved/pending-release/${botClient}`, {
|
|
21
|
+
params: { guildId }
|
|
22
|
+
});
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
async markAsReleased(id) {
|
|
26
|
+
const { data } = await config.api.patch(`/orders/${id}/release`, {});
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
async aprove(id) {
|
|
30
|
+
const { data } = await config.api.patch(`/orders/${id}/approve`, {});
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const ordersService = new OrderService();
|
|
35
|
+
|
|
36
|
+
module.exports = ordersService;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { api } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
class OrderService {
|
|
4
|
+
async create(args) {
|
|
5
|
+
const { data } = await api.post("/orders", args);
|
|
6
|
+
return data;
|
|
7
|
+
}
|
|
8
|
+
async get(orderId) {
|
|
9
|
+
const { data } = await api.get(`/orders/${orderId}`);
|
|
10
|
+
console.log(data);
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
async getPayment(orderId) {
|
|
14
|
+
const { data } = await api.get(`/orders/payment/${orderId}`);
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
async getApprovedUnprocessed(botClient, guildId) {
|
|
18
|
+
const { data } = await api.get(`/orders/approved/pending-release/${botClient}`, {
|
|
19
|
+
params: { guildId }
|
|
20
|
+
});
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
async markAsReleased(id) {
|
|
24
|
+
const { data } = await api.patch(`/orders/${id}/release`, {});
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
async aprove(id) {
|
|
28
|
+
const { data } = await api.patch(`/orders/${id}/approve`, {});
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const ordersService = new OrderService();
|
|
33
|
+
|
|
34
|
+
export { ordersService as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('../config.cjs');
|
|
4
|
+
|
|
5
|
+
class PaymentService {
|
|
6
|
+
async getOrCreate(guildId) {
|
|
7
|
+
const { data } = await config.api.get(`/payment/${guildId}`);
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
async update(args) {
|
|
11
|
+
const { data } = await config.api.put(
|
|
12
|
+
`/payment/${args.guildId}`,
|
|
13
|
+
args.data
|
|
14
|
+
);
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
async getByCaching(guildId) {
|
|
18
|
+
const { data } = await config.api.get(
|
|
19
|
+
`/payment/caching/${guildId}`
|
|
20
|
+
);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const PaymentService$1 = new PaymentService();
|
|
25
|
+
|
|
26
|
+
module.exports = PaymentService$1;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { api } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
let PaymentService$1 = class PaymentService {
|
|
4
|
+
async getOrCreate(guildId) {
|
|
5
|
+
const { data } = await api.get(`/payment/${guildId}`);
|
|
6
|
+
return data;
|
|
7
|
+
}
|
|
8
|
+
async update(args) {
|
|
9
|
+
const { data } = await api.put(
|
|
10
|
+
`/payment/${args.guildId}`,
|
|
11
|
+
args.data
|
|
12
|
+
);
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
async getByCaching(guildId) {
|
|
16
|
+
const { data } = await api.get(
|
|
17
|
+
`/payment/caching/${guildId}`
|
|
18
|
+
);
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const PaymentService = new PaymentService$1();
|
|
23
|
+
|
|
24
|
+
export { PaymentService as default };
|