29 lines
882 B
TypeScript
29 lines
882 B
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Param,
|
|
ParseUUIDPipe,
|
|
Query,
|
|
UseGuards,
|
|
} from '@nestjs/common';
|
|
import { Public } from '../identity/access.decorator';
|
|
import { pageSchema, type PageInput } from '../identity/identity.schemas';
|
|
import { SchemaPipe } from '../common/validation.pipe';
|
|
import { StorefrontGuard } from '../catalog/storefront.guard';
|
|
import { ReviewStore } from './review.store';
|
|
|
|
@Public()
|
|
@UseGuards(StorefrontGuard)
|
|
@Controller('storefront/:organizationId/products/:productId/reviews')
|
|
export class PublicReviewsController {
|
|
constructor(private readonly reviews: ReviewStore) {}
|
|
@Get()
|
|
list(
|
|
@Param('organizationId', ParseUUIDPipe) organizationId: string,
|
|
@Param('productId', ParseUUIDPipe) productId: string,
|
|
@Query(new SchemaPipe(pageSchema)) page: PageInput,
|
|
) {
|
|
return this.reviews.publicList(organizationId, productId, page);
|
|
}
|
|
}
|