| ON p.id = dp.pageId | ON p.id = dp.pageId | ||||
| WHERE dp.documentId = ?", $id); | WHERE dp.documentId = ?", $id); | ||||
| while(my $hash = $q->fetchrow_hashref()) { | while(my $hash = $q->fetchrow_hashref()) { | ||||
| if ( $hash->{isprimary} ) { | |||||
| $document->{primary} = $hash->{id}; | |||||
| } | |||||
| push @pages, $hash; push @pageids, $hash->{id}; | push @pages, $hash; push @pageids, $hash->{id}; | ||||
| } | } | ||||
| my $out = { | my $out = { | ||||
| id => $document->{id}, | id => $document->{id}, | ||||
| pageId => [ @pageids ], | pageId => [ @pageids ], | ||||
| primaryPage => $document->{primary}, | |||||
| name => $document->{name}, | name => $document->{name}, | ||||
| created => $document->{created}, | created => $document->{created}, | ||||
| owner => $document->{owner}, | owner => $document->{owner}, |