File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -51,11 +51,18 @@ public function property(string $propertyId): Property|EntityCollection
51
51
return new EntityCollection ();
52
52
}
53
53
54
- $ type = $ rawContent ['results ' ][0 ]['type ' ];
54
+ $ type = $ rawContent ['type ' ] ?? $ rawContent ['results ' ][0 ]['type ' ];
55
+
56
+ // if($type === 'rollup'){
57
+ // dd($rawContent['type']);
58
+ // }
59
+ // if($)
60
+ // dd("HI");
55
61
56
62
return match ($ type ) {
57
63
'people ' => new UserCollection ($ rawContent ),
58
- default => new EntityCollection ($ rawContent )
64
+ // 'rollup' => new Collection
65
+ default => dd ($ rawContent ) && new EntityCollection ($ rawContent )
59
66
};
60
67
}
61
68
Original file line number Diff line number Diff line change 2
2
3
3
use FiveamCode \LaravelNotionApi \Entities \Collections \EntityCollection ;
4
4
use FiveamCode \LaravelNotionApi \Entities \Properties \Property ;
5
+ use FiveamCode \LaravelNotionApi \Entities \Properties \Rollup ;
5
6
use Illuminate \Support \Facades \Http ;
6
7
7
8
$ httpRecorder = null ;
19
20
20
21
$ propertyKeys = $ databaseStructure ->getProperties ()->map (fn ($ o ) => $ o ->getTitle ());
21
22
23
+ // dd($propertyKeys);
24
+
25
+ expect ($ propertyKeys )->toBeInstanceOf (\Illuminate \Support \Collection::class);
26
+ expect ($ propertyKeys )->toHaveCount (16 );
27
+
28
+ // dd($propertyKeys);
29
+
22
30
foreach ($ propertyKeys as $ propertyKey ) {
23
31
$ id = $ databaseStructure ->getProperty ($ propertyKey )->getId ();
24
32
$ property = \Notion::page ('f1884dca3885460e93f52bf4da7cce8e ' )->property ($ id );
25
33
34
+ match ($ propertyKey ){
35
+ 'Rollup ' => dd ($ property ->asCollection ()) && expect ($ property ->asCollection ()->first ())->toBeInstanceOf (Rollup::class),
36
+ // default => throw new \Exception('Unknown property key')
37
+ default => null
38
+ };
39
+
26
40
if ($ propertyKey == 'Rollup ' || $ propertyKey == 'Person ' || $ propertyKey == 'Name ' ) {
27
41
expect ($ property )->toBeInstanceOf (EntityCollection::class);
28
42
} else {
You can’t perform that action at this time.
0 commit comments