Compare commits
2 Commits
v4.0.9
...
dev-v4.0.10
| Author | SHA1 | Date | |
|---|---|---|---|
| 77e9917a18 | |||
| 44bfbe0bef |
@@ -0,0 +1,12 @@
|
|||||||
|
import { IsString, IsNotEmpty, IsOptional, IsInt, Min } from 'class-validator';
|
||||||
|
|
||||||
|
export class AssignCategoryDto {
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
categoryId!: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsInt()
|
||||||
|
@Min(0)
|
||||||
|
priority?: number;
|
||||||
|
}
|
||||||
@@ -109,10 +109,42 @@ export class PartnerStoreController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
detail(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
async detail(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
||||||
return this.storeService.partnerGetStore(user.actorId, BigInt(id));
|
return this.storeService.partnerGetStore(user.actorId, BigInt(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get(':id/categories')
|
||||||
|
async getCategories(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
||||||
|
return this.storeService.getStoreCategories(BigInt(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(':id/categories')
|
||||||
|
async assignCategory(
|
||||||
|
@CurrentUser() user: AuthUser,
|
||||||
|
@Param('id') id: string,
|
||||||
|
@Body() body: { categoryId: string; priority?: number },
|
||||||
|
) {
|
||||||
|
return this.storeService.assignCategoryToStore(BigInt(id), body.categoryId, body.priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete(':id/categories/:categoryId')
|
||||||
|
async removeCategory(
|
||||||
|
@CurrentUser() user: AuthUser,
|
||||||
|
@Param('id') id: string,
|
||||||
|
@Param('categoryId') categoryId: string,
|
||||||
|
) {
|
||||||
|
return this.storeService.removeCategoryFromStore(BigInt(id), categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Put(':id/categories')
|
||||||
|
async replaceCategories(
|
||||||
|
@CurrentUser() user: AuthUser,
|
||||||
|
@Param('id') id: string,
|
||||||
|
@Body() body: { categoryIds: string[]; priorities?: Record<string, number> },
|
||||||
|
) {
|
||||||
|
return this.storeService.replaceStoreCategories(BigInt(id), body.categoryIds, body.priorities);
|
||||||
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
create(@CurrentUser() user: AuthUser, @Body() body: Record<string, unknown>) {
|
create(@CurrentUser() user: AuthUser, @Body() body: Record<string, unknown>) {
|
||||||
return this.storeService.createStore(user.actorId, body);
|
return this.storeService.createStore(user.actorId, body);
|
||||||
|
|||||||
Reference in New Issue
Block a user