@passly-nl/data 1.0.1 → 1.0.2
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.d.mts +58 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/adapter/EventAdapter.ts +6 -1
- package/src/adapter/MerchantAdapter.ts +1 -0
- package/src/adapter/ProductAdapter.ts +3 -2
- package/src/adapter/PublicShopAdapter.ts +11 -2
- package/src/dto/event/ShopElementInformationDto.ts +9 -0
- package/src/dto/event/index.ts +1 -0
- package/src/dto/merchant/MerchantUserDto.ts +12 -1
- package/src/dto/product/ProductDto.ts +12 -1
- package/src/dto/publicShop/PublicShopElementInformationDto.ts +9 -0
- package/src/dto/publicShop/PublicShopEventDto.ts +42 -1
- package/src/dto/publicShop/index.ts +1 -0
- package/src/service/AdminMerchantService.ts +15 -0
- package/src/service/AdminMerchantsService.ts +17 -0
- package/src/service/AdminService.ts +4 -0
- package/src/service/MerchantContractService.ts +60 -0
- package/src/service/MerchantEventProductService.ts +3 -1
- package/src/service/MerchantEventProductsService.ts +4 -2
- package/src/service/MerchantUserService.ts +38 -0
- package/src/service/index.ts +5 -0
- package/src/types/auth.ts +3 -0
- package/src/types/event.ts +1 -0
- package/src/types/publicShop.ts +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@passly-nl/data",
|
|
3
3
|
"description": "API implementation for Passly.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/basmilius",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"./*": "./*"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@basmilius/http-client": "^3.
|
|
54
|
-
"@flux-ui/types": "^3.0.0-next.
|
|
53
|
+
"@basmilius/http-client": "^3.11.1",
|
|
54
|
+
"@flux-ui/types": "^3.0.0-next.32",
|
|
55
55
|
"@fortawesome/fontawesome-common-types": "^7.2.0",
|
|
56
|
-
"apexcharts": "^5.10.
|
|
56
|
+
"apexcharts": "^5.10.3",
|
|
57
57
|
"luxon": "^3.7.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/luxon": "^3.7.1",
|
|
61
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
62
|
-
"tsdown": "^0.21.
|
|
61
|
+
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
|
|
62
|
+
"tsdown": "^0.21.1"
|
|
63
63
|
},
|
|
64
64
|
"overrides": {
|
|
65
65
|
"@disabled-basmilius/http-client": "link:@basmilius/http-client",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { adapter, ForeignData } from '@basmilius/http-client';
|
|
2
2
|
import { AddressAdapter, AuthAdapter, DateTimeAdapter, FileSystemAdapter, MerchantAdapter, PaymentAdapter, ProductAdapter } from '#data/adapter';
|
|
3
|
-
import { AppTeamDto, EventAvailabilityDto, EventCountersDto, EventDto, EventStatisticsAttendanceDto, EventStatisticsBuyerTotalsDto, EventStatisticsFinancialDto, EventStatisticsOrdersDto, EventStatisticsOrderTotalsDto, EventStatisticsScansDto, EventStatisticsScansPerAppTeamDto, EventStatisticsScanTotalsDto, EventStatisticsSwapTotalsDto, ShopDesignDto, ShopDto, ShopElementButtonDto, ShopElementDividerDto, ShopElementDto, ShopElementHeadingDto, ShopElementNoticeDto, ShopElementProductDto, ShopElementTextDto, StockOverviewDto, StockOverviewItemDto, StockPoolDto, TicketTemplateDto } from '#data/dto';
|
|
3
|
+
import { AppTeamDto, EventAvailabilityDto, EventCountersDto, EventDto, EventStatisticsAttendanceDto, EventStatisticsBuyerTotalsDto, EventStatisticsFinancialDto, EventStatisticsOrdersDto, EventStatisticsOrderTotalsDto, EventStatisticsScansDto, EventStatisticsScansPerAppTeamDto, EventStatisticsScanTotalsDto, EventStatisticsSwapTotalsDto, ShopDesignDto, ShopDto, ShopElementButtonDto, ShopElementDividerDto, ShopElementDto, ShopElementHeadingDto, ShopElementInformationDto, ShopElementNoticeDto, ShopElementProductDto, ShopElementTextDto, StockOverviewDto, StockOverviewItemDto, StockPoolDto, TicketTemplateDto } from '#data/dto';
|
|
4
4
|
import { optional } from '#data/util';
|
|
5
5
|
|
|
6
6
|
@adapter
|
|
@@ -104,6 +104,11 @@ export class EventAdapter {
|
|
|
104
104
|
data.title
|
|
105
105
|
);
|
|
106
106
|
|
|
107
|
+
case 'information':
|
|
108
|
+
return new ShopElementInformationDto(
|
|
109
|
+
data.id
|
|
110
|
+
);
|
|
111
|
+
|
|
107
112
|
case 'notice':
|
|
108
113
|
return new ShopElementNoticeDto(
|
|
109
114
|
data.id,
|
|
@@ -50,6 +50,7 @@ export class MerchantAdapter {
|
|
|
50
50
|
static parseMerchantUser(data: ForeignData): MerchantUserDto {
|
|
51
51
|
return new MerchantUserDto(
|
|
52
52
|
data.is_manager,
|
|
53
|
+
data.claims ?? [],
|
|
53
54
|
DateTimeAdapter.parseDateTime(data.created_on),
|
|
54
55
|
DateTimeAdapter.parseDateTime(data.updated_on),
|
|
55
56
|
AuthAdapter.parseUser(data.user)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { adapter, ForeignData } from '@basmilius/http-client';
|
|
2
|
-
import { EventAdapter, FileSystemAdapter, PaymentAdapter } from '#data/adapter';
|
|
2
|
+
import { DateTimeAdapter, EventAdapter, FileSystemAdapter, PaymentAdapter } from '#data/adapter';
|
|
3
3
|
import { ProductDto } from '#data/dto';
|
|
4
4
|
import { optional, optionalArray } from '#data/util';
|
|
5
5
|
|
|
@@ -18,7 +18,8 @@ export class ProductAdapter {
|
|
|
18
18
|
data.remaining_stock,
|
|
19
19
|
optional(data.stock_pool, EventAdapter.parseStockPool),
|
|
20
20
|
optional(data.image, FileSystemAdapter.parsePicture),
|
|
21
|
-
optionalArray(data.images, FileSystemAdapter.parsePicture)
|
|
21
|
+
optionalArray(data.images, FileSystemAdapter.parsePicture)!,
|
|
22
|
+
optional(data.tickets_released_on, DateTimeAdapter.parseDateTime)
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { adapter, ForeignData } from '@basmilius/http-client';
|
|
2
2
|
import { AddressAdapter, DateTimeAdapter, FileSystemAdapter, PaymentAdapter } from '#data/adapter';
|
|
3
|
-
import { PublicShopDesignDto, PublicShopDto, PublicShopElementButtonDto, PublicShopElementDividerDto, PublicShopElementDto, PublicShopElementHeadingDto, PublicShopElementNoticeDto, PublicShopElementProductDto, PublicShopElementTextDto, PublicShopEventDto, PublicShopMerchantDto, PublicShopProductDto, PublicShopReservationDto, PublicShopReservationProductDetailsDto, PublicShopReservationProductDto, PublicShopTimeSlotDto } from '#data/dto';
|
|
3
|
+
import { PublicShopDesignDto, PublicShopDto, PublicShopElementButtonDto, PublicShopElementDividerDto, PublicShopElementDto, PublicShopElementHeadingDto, PublicShopElementInformationDto, PublicShopElementNoticeDto, PublicShopElementProductDto, PublicShopElementTextDto, PublicShopEventDto, PublicShopMerchantDto, PublicShopProductDto, PublicShopReservationDto, PublicShopReservationProductDetailsDto, PublicShopReservationProductDto, PublicShopTimeSlotDto } from '#data/dto';
|
|
4
4
|
import { optional, optionalArray } from '#data/util';
|
|
5
5
|
|
|
6
6
|
@adapter
|
|
@@ -55,6 +55,11 @@ export class PublicShopAdapter {
|
|
|
55
55
|
data.title
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
+
case 'information':
|
|
59
|
+
return new PublicShopElementInformationDto(
|
|
60
|
+
data.id
|
|
61
|
+
);
|
|
62
|
+
|
|
58
63
|
case 'notice':
|
|
59
64
|
return new PublicShopElementNoticeDto(
|
|
60
65
|
data.id,
|
|
@@ -84,9 +89,13 @@ export class PublicShopAdapter {
|
|
|
84
89
|
return new PublicShopEventDto(
|
|
85
90
|
data.id,
|
|
86
91
|
data.name,
|
|
92
|
+
data.description,
|
|
87
93
|
data.status,
|
|
88
94
|
AddressAdapter.parseAddress(data.address),
|
|
89
|
-
optional(data.header_file, FileSystemAdapter.parsePicture)
|
|
95
|
+
optional(data.header_file, FileSystemAdapter.parsePicture),
|
|
96
|
+
data.minimum_age,
|
|
97
|
+
DateTimeAdapter.parseDateTime(data.starts_on),
|
|
98
|
+
DateTimeAdapter.parseDateTime(data.ends_on)
|
|
90
99
|
);
|
|
91
100
|
}
|
|
92
101
|
|
package/src/dto/event/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './ShopElementDto';
|
|
|
17
17
|
export * from './ShopElementButtonDto';
|
|
18
18
|
export * from './ShopElementDividerDto';
|
|
19
19
|
export * from './ShopElementHeadingDto';
|
|
20
|
+
export * from './ShopElementInformationDto';
|
|
20
21
|
export * from './ShopElementNoticeDto';
|
|
21
22
|
export * from './ShopElementProductDto';
|
|
22
23
|
export * from './ShopElementTextDto';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dto } from '@basmilius/http-client';
|
|
2
2
|
import type { DateTime } from 'luxon';
|
|
3
3
|
import type { UserDto } from '#data/dto';
|
|
4
|
+
import type { Claim } from '#data/types';
|
|
4
5
|
|
|
5
6
|
@dto
|
|
6
7
|
export class MerchantUserDto {
|
|
@@ -12,6 +13,14 @@ export class MerchantUserDto {
|
|
|
12
13
|
this.#isManager = value;
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
get claims(): Claim[] {
|
|
17
|
+
return this.#claims;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
set claims(value: Claim[]) {
|
|
21
|
+
this.#claims = value;
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
get createdOn(): DateTime {
|
|
16
25
|
return this.#createdOn;
|
|
17
26
|
}
|
|
@@ -37,12 +46,14 @@ export class MerchantUserDto {
|
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
#isManager: boolean;
|
|
49
|
+
#claims: Claim[];
|
|
40
50
|
#createdOn: DateTime;
|
|
41
51
|
#updatedOn: DateTime;
|
|
42
52
|
#user: UserDto;
|
|
43
53
|
|
|
44
|
-
constructor(isManager: boolean, createdOn: DateTime, updatedOn: DateTime, user: UserDto) {
|
|
54
|
+
constructor(isManager: boolean, claims: Claim[], createdOn: DateTime, updatedOn: DateTime, user: UserDto) {
|
|
45
55
|
this.#isManager = isManager;
|
|
56
|
+
this.#claims = claims;
|
|
46
57
|
this.#createdOn = createdOn;
|
|
47
58
|
this.#updatedOn = updatedOn;
|
|
48
59
|
this.#user = user;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { dto } from '@basmilius/http-client';
|
|
2
|
+
import type { DateTime } from 'luxon';
|
|
2
3
|
import type { CostDto, PictureDto, StockPoolDto } from '#data/dto';
|
|
3
4
|
import type { ProductType } from '#data/types';
|
|
4
5
|
|
|
@@ -100,6 +101,14 @@ export class ProductDto {
|
|
|
100
101
|
this.#images = value;
|
|
101
102
|
}
|
|
102
103
|
|
|
104
|
+
get ticketsReleasedOn(): DateTime | null {
|
|
105
|
+
return this.#ticketsReleasedOn;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
set ticketsReleasedOn(value: DateTime | null) {
|
|
109
|
+
this.#ticketsReleasedOn = value;
|
|
110
|
+
}
|
|
111
|
+
|
|
103
112
|
#id: string;
|
|
104
113
|
#type: ProductType;
|
|
105
114
|
#name: string;
|
|
@@ -112,8 +121,9 @@ export class ProductDto {
|
|
|
112
121
|
#stock: StockPoolDto;
|
|
113
122
|
#image: PictureDto;
|
|
114
123
|
#images: PictureDto[];
|
|
124
|
+
#ticketsReleasedOn: DateTime | null;
|
|
115
125
|
|
|
116
|
-
constructor(id: string, type: ProductType, name: string, description: string, price: CostDto, maxQuantity: number, isActive: boolean, isSwappable: boolean, remainingStock: number, stock: StockPoolDto, image: PictureDto, images: PictureDto[]) {
|
|
126
|
+
constructor(id: string, type: ProductType, name: string, description: string, price: CostDto, maxQuantity: number, isActive: boolean, isSwappable: boolean, remainingStock: number, stock: StockPoolDto, image: PictureDto, images: PictureDto[], ticketsReleasedOn: DateTime | null) {
|
|
117
127
|
this.#id = id;
|
|
118
128
|
this.#type = type;
|
|
119
129
|
this.#name = name;
|
|
@@ -126,5 +136,6 @@ export class ProductDto {
|
|
|
126
136
|
this.#stock = stock;
|
|
127
137
|
this.#image = image;
|
|
128
138
|
this.#images = images;
|
|
139
|
+
this.#ticketsReleasedOn = ticketsReleasedOn;
|
|
129
140
|
}
|
|
130
141
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { dto } from '@basmilius/http-client';
|
|
2
|
+
import type { DateTime } from 'luxon';
|
|
2
3
|
import type { AddressDto, PictureDto } from '#data/dto';
|
|
3
4
|
import type { EventStatus } from '#data/types';
|
|
4
5
|
|
|
@@ -20,6 +21,14 @@ export class PublicShopEventDto {
|
|
|
20
21
|
this.#name = value;
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
get description(): string {
|
|
25
|
+
return this.#description;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set description(value: string) {
|
|
29
|
+
this.#description = value;
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
get status(): EventStatus {
|
|
24
33
|
return this.#status;
|
|
25
34
|
}
|
|
@@ -44,17 +53,49 @@ export class PublicShopEventDto {
|
|
|
44
53
|
this.#headerFile = value;
|
|
45
54
|
}
|
|
46
55
|
|
|
56
|
+
get minimumAge(): number {
|
|
57
|
+
return this.#minimumAge;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
set minimumAge(value: number) {
|
|
61
|
+
this.#minimumAge = value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get startsOn(): DateTime {
|
|
65
|
+
return this.#startsOn;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
set startsOn(value: DateTime) {
|
|
69
|
+
this.#startsOn = value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
get endsOn(): DateTime {
|
|
73
|
+
return this.#endsOn;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
set endsOn(value: DateTime) {
|
|
77
|
+
this.#endsOn = value;
|
|
78
|
+
}
|
|
79
|
+
|
|
47
80
|
#id: string;
|
|
48
81
|
#name: string;
|
|
82
|
+
#description: string;
|
|
49
83
|
#status: EventStatus;
|
|
50
84
|
#address: AddressDto;
|
|
51
85
|
#headerFile: PictureDto | null;
|
|
86
|
+
#minimumAge: number;
|
|
87
|
+
#startsOn: DateTime;
|
|
88
|
+
#endsOn: DateTime;
|
|
52
89
|
|
|
53
|
-
constructor(id: string, name: string, status: EventStatus, address: AddressDto, headerFile: PictureDto | null) {
|
|
90
|
+
constructor(id: string, name: string, description: string, status: EventStatus, address: AddressDto, headerFile: PictureDto | null, minimumAge: number, startsOn: DateTime, endsOn: DateTime) {
|
|
54
91
|
this.#id = id;
|
|
55
92
|
this.#name = name;
|
|
93
|
+
this.#description = description;
|
|
56
94
|
this.#status = status;
|
|
57
95
|
this.#address = address;
|
|
58
96
|
this.#headerFile = headerFile;
|
|
97
|
+
this.#minimumAge = minimumAge;
|
|
98
|
+
this.#startsOn = startsOn;
|
|
99
|
+
this.#endsOn = endsOn;
|
|
59
100
|
}
|
|
60
101
|
}
|
|
@@ -5,6 +5,7 @@ export * from './PublicShopElementDto';
|
|
|
5
5
|
export * from './PublicShopElementButtonDto';
|
|
6
6
|
export * from './PublicShopElementDividerDto';
|
|
7
7
|
export * from './PublicShopElementHeadingDto';
|
|
8
|
+
export * from './PublicShopElementInformationDto';
|
|
8
9
|
export * from './PublicShopElementNoticeDto';
|
|
9
10
|
export * from './PublicShopElementProductDto';
|
|
10
11
|
export * from './PublicShopElementTextDto';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import { MerchantAdapter } from '#data/adapter';
|
|
3
|
+
import { MerchantDto } from '#data/dto';
|
|
4
|
+
|
|
5
|
+
export class AdminMerchantService extends BaseService {
|
|
6
|
+
async get(merchantId: string): Promise<BaseResponse<MerchantDto>> {
|
|
7
|
+
return await this
|
|
8
|
+
.request(`/admin/merchants/${merchantId}`)
|
|
9
|
+
.method('get')
|
|
10
|
+
.queryString(QueryString.builder()
|
|
11
|
+
.append('language', 'nl'))
|
|
12
|
+
.bearerToken()
|
|
13
|
+
.runAdapter(MerchantAdapter.parseMerchant);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type BaseResponse, BaseService, type Paginated, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import { MerchantAdapter } from '#data/adapter';
|
|
3
|
+
import { MerchantDto } from '#data/dto';
|
|
4
|
+
|
|
5
|
+
export class AdminMerchantsService extends BaseService {
|
|
6
|
+
async get(offset: number, limit: number): Promise<BaseResponse<Paginated<MerchantDto>>> {
|
|
7
|
+
return await this
|
|
8
|
+
.request('/admin/merchants')
|
|
9
|
+
.method('get')
|
|
10
|
+
.queryString(QueryString.builder()
|
|
11
|
+
.append('language', 'nl')
|
|
12
|
+
.append('offset', offset)
|
|
13
|
+
.append('limit', limit))
|
|
14
|
+
.bearerToken()
|
|
15
|
+
.runPaginatedAdapter(MerchantAdapter.parseMerchant);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import { MerchantAdapter } from '#data/adapter';
|
|
3
|
+
import type { ContractDto } from '#data/dto';
|
|
4
|
+
import type { DateTime } from 'luxon';
|
|
5
|
+
|
|
6
|
+
export class MerchantContractService extends BaseService {
|
|
7
|
+
async get(merchantId: string, offset: number, limit: number): Promise<BaseResponse<Paginated<ContractDto>>> {
|
|
8
|
+
return await this
|
|
9
|
+
.request(`/merchants/${merchantId}/contracts`)
|
|
10
|
+
.method('get')
|
|
11
|
+
.bearerToken()
|
|
12
|
+
.queryString(QueryString.builder()
|
|
13
|
+
.append('language', 'nl')
|
|
14
|
+
.append('offset', offset)
|
|
15
|
+
.append('limit', limit))
|
|
16
|
+
.runPaginatedAdapter(MerchantAdapter.parseContract);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async getSingle(merchantId: string, contractId: string): Promise<BaseResponse<ContractDto>> {
|
|
20
|
+
return await this
|
|
21
|
+
.request(`/merchants/${merchantId}/contracts/${contractId}`)
|
|
22
|
+
.method('get')
|
|
23
|
+
.bearerToken()
|
|
24
|
+
.queryString(QueryString.builder()
|
|
25
|
+
.append('language', 'nl'))
|
|
26
|
+
.runAdapter(MerchantAdapter.parseContract);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async post(merchantId: string, startsOn: DateTime, endsOn: DateTime, feeCents: number, remark: string): Promise<BaseResponse<ContractDto>> {
|
|
30
|
+
return await this
|
|
31
|
+
.request(`/merchants/${merchantId}/contracts`)
|
|
32
|
+
.method('post')
|
|
33
|
+
.bearerToken()
|
|
34
|
+
.queryString(QueryString.builder()
|
|
35
|
+
.append('language', 'nl'))
|
|
36
|
+
.body({
|
|
37
|
+
starts_on: startsOn.toISO(),
|
|
38
|
+
ends_on: endsOn.toISO(),
|
|
39
|
+
fee_cents: feeCents,
|
|
40
|
+
remark: remark || undefined
|
|
41
|
+
})
|
|
42
|
+
.runAdapter(MerchantAdapter.parseContract);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async put(merchantId: string, contractId: string, startsOn: DateTime, endsOn: DateTime, feeCents: number, remark: string): Promise<BaseResponse<ContractDto>> {
|
|
46
|
+
return await this
|
|
47
|
+
.request(`/merchants/${merchantId}/contracts/${contractId}`)
|
|
48
|
+
.method('put')
|
|
49
|
+
.bearerToken()
|
|
50
|
+
.queryString(QueryString.builder()
|
|
51
|
+
.append('language', 'nl'))
|
|
52
|
+
.body({
|
|
53
|
+
starts_on: startsOn.toISO(),
|
|
54
|
+
ends_on: endsOn.toISO(),
|
|
55
|
+
fee_cents: feeCents,
|
|
56
|
+
remark: remark || undefined
|
|
57
|
+
})
|
|
58
|
+
.runAdapter(MerchantAdapter.parseContract);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import type { DateTime } from 'luxon';
|
|
2
3
|
import { ProductAdapter } from '#data/adapter';
|
|
3
4
|
import type { ProductDto } from '#data/dto';
|
|
4
5
|
|
|
@@ -39,7 +40,8 @@ export class MerchantEventProductService extends BaseService {
|
|
|
39
40
|
description: product.description,
|
|
40
41
|
price: product.price.cents,
|
|
41
42
|
max_quantity: product.maxQuantity,
|
|
42
|
-
is_swappable: product.isSwappable
|
|
43
|
+
is_swappable: product.isSwappable,
|
|
44
|
+
tickets_released_on: product.ticketsReleasedOn?.toISO() ?? null
|
|
43
45
|
})
|
|
44
46
|
.runAdapter(ProductAdapter.parseProduct);
|
|
45
47
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseResponse, BaseService, Paginated, QueryString } from '@basmilius/http-client';
|
|
2
2
|
import type { FluxFormSelectEntry } from '@flux-ui/types';
|
|
3
|
+
import type { DateTime } from 'luxon';
|
|
3
4
|
import { FluxAdapter, ProductAdapter } from '#data/adapter';
|
|
4
5
|
import type { ProductDto } from '#data/dto';
|
|
5
6
|
|
|
@@ -28,7 +29,7 @@ export class MerchantEventProductsService extends BaseService {
|
|
|
28
29
|
.runArrayAdapter(FluxAdapter.parseFluxFormSelectEntry);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
async post(merchantId: string, eventId: string, name: string, description: string, price: number, maxQuantity: number, stock: number | null, stockPoolId: string | null): Promise<BaseResponse<ProductDto>> {
|
|
32
|
+
async post(merchantId: string, eventId: string, name: string, description: string, price: number, maxQuantity: number, stock: number | null, stockPoolId: string | null, ticketsReleasedOn: DateTime | null = null): Promise<BaseResponse<ProductDto>> {
|
|
32
33
|
return await this
|
|
33
34
|
.request(`/merchants/${merchantId}/events/${eventId}/products`)
|
|
34
35
|
.method('post')
|
|
@@ -41,7 +42,8 @@ export class MerchantEventProductsService extends BaseService {
|
|
|
41
42
|
price,
|
|
42
43
|
stock,
|
|
43
44
|
max_quantity: maxQuantity,
|
|
44
|
-
stock_pool_id: stockPoolId
|
|
45
|
+
stock_pool_id: stockPoolId,
|
|
46
|
+
tickets_released_on: ticketsReleasedOn?.toISO() ?? null
|
|
45
47
|
})
|
|
46
48
|
.runAdapter(ProductAdapter.parseProduct);
|
|
47
49
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
|
|
2
|
+
import { MerchantAdapter } from '#data/adapter';
|
|
3
|
+
import type { MerchantUserDto } from '#data/dto';
|
|
4
|
+
import type { Claim } from '#data/types';
|
|
5
|
+
|
|
6
|
+
export class MerchantUserService extends BaseService {
|
|
7
|
+
async get(merchantId: string, userId: string): Promise<BaseResponse<MerchantUserDto>> {
|
|
8
|
+
return await this
|
|
9
|
+
.request(`/merchants/${merchantId}/users/${userId}`)
|
|
10
|
+
.method('get')
|
|
11
|
+
.bearerToken()
|
|
12
|
+
.queryString(QueryString.builder()
|
|
13
|
+
.append('language', 'nl'))
|
|
14
|
+
.runAdapter(MerchantAdapter.parseMerchantUser);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async put(merchantId: string, userId: string, isManager: boolean, claims: Claim[]): Promise<BaseResponse<MerchantUserDto>> {
|
|
18
|
+
return await this
|
|
19
|
+
.request(`/merchants/${merchantId}/users/${userId}`)
|
|
20
|
+
.method('put')
|
|
21
|
+
.bearerToken()
|
|
22
|
+
.queryString(QueryString.builder()
|
|
23
|
+
.append('language', 'nl'))
|
|
24
|
+
.body({
|
|
25
|
+
is_manager: isManager,
|
|
26
|
+
claims
|
|
27
|
+
})
|
|
28
|
+
.runAdapter(MerchantAdapter.parseMerchantUser);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async remove(merchantId: string, userId: string): Promise<BaseResponse<void>> {
|
|
32
|
+
return await this
|
|
33
|
+
.request(`/merchants/${merchantId}/users/${userId}`)
|
|
34
|
+
.method('delete')
|
|
35
|
+
.bearerToken()
|
|
36
|
+
.runEmpty();
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/service/index.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export * from './AdminService';
|
|
2
|
+
export * from './AdminMerchantService';
|
|
3
|
+
export * from './AdminMerchantsService';
|
|
1
4
|
export * from './AuthService';
|
|
2
5
|
export * from './InvitationService';
|
|
3
6
|
export * from './MerchantService';
|
|
4
7
|
export * from './MerchantsService';
|
|
8
|
+
export * from './MerchantContractService';
|
|
5
9
|
export * from './MerchantBuyerService';
|
|
6
10
|
export * from './MerchantBuyersService';
|
|
7
11
|
export * from './MerchantDashboardService';
|
|
@@ -31,6 +35,7 @@ export * from './MerchantStatisticsOverviewService';
|
|
|
31
35
|
export * from './MerchantStatisticsSalesService';
|
|
32
36
|
export * from './MerchantTicketService';
|
|
33
37
|
export * from './MerchantTicketsService';
|
|
38
|
+
export * from './MerchantUserService';
|
|
34
39
|
export * from './MerchantUsersService';
|
|
35
40
|
export * from './MeService';
|
|
36
41
|
export * from './PublicOrderService';
|
package/src/types/auth.ts
CHANGED
package/src/types/event.ts
CHANGED