@@ -3,10 +3,11 @@ import type { TraktApiTemplate, TraktApiTemplateOptions } from '~/models/trakt/t
3
3
4
4
import { TraktApiExtended , TraktClientEndpoint } from '~/models/trakt/trakt-client.model' ;
5
5
6
- import { validateStartDate } from '~/models/trakt/trakt-entity.model' ;
6
+ import { getDateTransform , getDateValidate } from '~/models/trakt/trakt-entity.model' ;
7
7
import { TraktApiCommonFilterValues } from '~/services/trakt-client/api/trakt-api.filters' ;
8
8
9
9
import { HttpMethod } from '~/utils/http.utils' ;
10
+ import { DateISO8601Short } from '~/utils/regex.utils' ;
10
11
11
12
const opts : TraktApiTemplateOptions = {
12
13
extended : [ TraktApiExtended . Full ] ,
@@ -19,7 +20,8 @@ const opts: TraktApiTemplateOptions = {
19
20
} ,
20
21
} ;
21
22
22
- const validate : TraktApiTemplate < TraktCalendarQuery > [ 'validate' ] = validateStartDate ;
23
+ const validate : TraktApiTemplate < TraktCalendarQuery > [ 'validate' ] = getDateValidate ( 'start_date' , DateISO8601Short ) ;
24
+ const transform : TraktApiTemplate < TraktCalendarQuery > [ 'transform' ] = getDateTransform ( 'start_date' , true ) ;
23
25
24
26
/**
25
27
* By default, the calendar will return all shows or movies for the specified time period and can be global or user specific.
@@ -48,6 +50,7 @@ export const calendars = {
48
50
url : '/calendars/my/shows/:start_date/:days' ,
49
51
opts : { auth : true , ...opts } ,
50
52
validate,
53
+ transform,
51
54
} ) ,
52
55
/**
53
56
* Returns all new show premieres (series_premiere) airing during the time period specified.
@@ -63,6 +66,7 @@ export const calendars = {
63
66
url : '/calendars/my/shows/new/:start_date/:days' ,
64
67
opts : { auth : true , ...opts } ,
65
68
validate,
69
+ transform,
66
70
} ) ,
67
71
/**
68
72
* Returns all show premieres (mid_season_premiere, season_premiere, series_premiere) airing during the time period specified.
@@ -78,6 +82,7 @@ export const calendars = {
78
82
url : '/calendars/my/shows/premieres/:start_date/:days' ,
79
83
opts : { auth : true , ...opts } ,
80
84
validate,
85
+ transform,
81
86
} ) ,
82
87
/**
83
88
* Returns all show finales (mid_season_finale, season_finale, series_finale) airing during the time period specified.
@@ -93,6 +98,7 @@ export const calendars = {
93
98
url : '/calendars/my/shows/finales/:start_date/:days' ,
94
99
opts : { auth : true , ...opts } ,
95
100
validate,
101
+ transform,
96
102
} ) ,
97
103
} ,
98
104
/**
@@ -109,6 +115,7 @@ export const calendars = {
109
115
url : '/calendars/my/movies/:start_date/:days' ,
110
116
opts : { auth : true , ...opts } ,
111
117
validate,
118
+ transform,
112
119
} ) ,
113
120
/**
114
121
* Returns all movies with a DVD release date during the time period specified.
@@ -124,6 +131,7 @@ export const calendars = {
124
131
url : '/calendars/my/dvd/:start_date/:days' ,
125
132
opts : { auth : true , ...opts } ,
126
133
validate,
134
+ transform,
127
135
} ) ,
128
136
} ,
129
137
all : {
@@ -140,6 +148,7 @@ export const calendars = {
140
148
url : '/calendars/all/shows/:start_date/:days' ,
141
149
opts,
142
150
validate,
151
+ transform,
143
152
} ) ,
144
153
/**
145
154
* Returns all new show premieres (series_premiere) airing during the time period specified.
@@ -153,6 +162,7 @@ export const calendars = {
153
162
url : '/calendars/all/shows/new/:start_date/:days' ,
154
163
opts,
155
164
validate,
165
+ transform,
156
166
} ) ,
157
167
/**
158
168
* Returns all show premieres (mid_season_premiere, season_premiere, series_premiere) airing during the time period specified.
@@ -166,6 +176,7 @@ export const calendars = {
166
176
url : '/calendars/all/shows/premieres/:start_date/:days' ,
167
177
opts,
168
178
validate,
179
+ transform,
169
180
} ) ,
170
181
/**
171
182
* Returns all show finales (mid_season_finale, season_finale, series_finale) airing during the time period specified.
@@ -179,6 +190,7 @@ export const calendars = {
179
190
url : '/calendars/all/finales/:start_date/:days' ,
180
191
opts,
181
192
validate,
193
+ transform,
182
194
} ) ,
183
195
/**
184
196
* Returns all movies with a release date during the time period specified.
@@ -192,6 +204,7 @@ export const calendars = {
192
204
url : '/calendars/all/movies/:start_date/:days' ,
193
205
opts,
194
206
validate,
207
+ transform,
195
208
} ) ,
196
209
} ,
197
210
/**
@@ -206,6 +219,7 @@ export const calendars = {
206
219
url : '/calendars/all/dvd/:start_date/:days' ,
207
220
opts,
208
221
validate,
222
+ transform,
209
223
} ) ,
210
224
} ,
211
225
} ;
0 commit comments