File tree 2 files changed +24
-2
lines changed
packages/cubejs-api-gateway
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const getPivotQuery = (queryType, queries) => {
40
40
41
41
const id = Joi . string ( ) . regex ( / ^ [ a - z A - Z 0 - 9 _ ] + \. [ a - z A - Z 0 - 9 _ ] + $ / ) ;
42
42
const idOrMemberExpressionName = Joi . string ( ) . regex ( / ^ [ a - z A - Z 0 - 9 _ ] + \. [ a - z A - Z 0 - 9 _ ] + $ | ^ [ a - z A - Z 0 - 9 _ ] + $ / ) ;
43
- const dimensionWithTime = Joi . string ( ) . regex ( / ^ [ a - z A - Z 0 - 9 _ ] + \. [ a - z A - Z 0 - 9 _ ] + ( \. ( s e c o n d | m i n u t e | h o u r | d a y | w e e k | m o n t h | y e a r ) ) ? $ / ) ;
43
+ const dimensionWithTime = Joi . string ( ) . regex ( / ^ [ a - z A - Z 0 - 9 _ ] + \. [ a - z A - Z 0 - 9 _ ] + ( \. [ a - z A - Z 0 - 9 _ ] + ) ? $ / ) ;
44
44
const parsedMemberExpression = Joi . object ( ) . keys ( {
45
45
expression : Joi . array ( ) . items ( Joi . string ( ) ) . min ( 1 ) . required ( ) ,
46
46
cubeName : Joi . string ( ) . required ( ) ,
Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ describe('API Gateway', () => {
316
316
expect ( res . body && res . body . data ) . toStrictEqual ( [ { 'Foo.bar' : 42 } ] ) ;
317
317
} ) ;
318
318
319
- test ( 'custom granularities in annotation' , async ( ) => {
319
+ test ( 'custom granularities in annotation from timeDimensions ' , async ( ) => {
320
320
const { app } = await createApiGateway ( ) ;
321
321
322
322
const res = await request ( app )
@@ -338,6 +338,28 @@ describe('API Gateway', () => {
338
338
} ) ;
339
339
} ) ;
340
340
341
+ test ( 'custom granularities in annotation from dimensions' , async ( ) => {
342
+ const { app } = await createApiGateway ( ) ;
343
+
344
+ const res = await request ( app )
345
+ . get (
346
+ '/cubejs-api/v1/load?query={"measures":["Foo.bar"],"dimensions":["Foo.timeGranularities.half_year_by_1st_april"]}'
347
+ )
348
+ . set ( 'Authorization' , 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.t-IDcSemACt8x4iTMCda8Yhe3iZaWbvV5XKSTbuAn0M' )
349
+ . expect ( 200 ) ;
350
+ console . log ( res . body ) ;
351
+ expect ( res . body && res . body . data ) . toStrictEqual ( [ { 'Foo.bar' : 42 } ] ) ;
352
+ expect ( res . body . annotation . timeDimensions [ 'Foo.timeGranularities.half_year_by_1st_april' ] )
353
+ . toStrictEqual ( {
354
+ granularity : {
355
+ name : 'half_year_by_1st_april' ,
356
+ title : 'Half Year By1 St April' ,
357
+ interval : '6 months' ,
358
+ offset : '3 months' ,
359
+ }
360
+ } ) ;
361
+ } ) ;
362
+
341
363
test ( 'dry-run' , async ( ) => {
342
364
const { app } = await createApiGateway ( ) ;
343
365
You can’t perform that action at this time.
0 commit comments