This commit is contained in:
2026-06-30 10:33:56 +08:00
commit 6e047dc0a5
607 changed files with 65966 additions and 0 deletions
@@ -0,0 +1,74 @@
import { Body, Controller, Get, Param, Post, Put, Query, UseGuards } from '@nestjs/common';
import { StoreService } from './store.service';
import { RedeemService } from '../redeem/redeem.service';
import { JwtAuthGuard, AuthUser } from '../../common/guards/jwt-auth.guard';
import { CurrentUser } from '../../common/decorators/current-user.decorator';
@Controller('stores')
export class PublicStoreController {
constructor(private readonly storeService: StoreService) {}
@Get()
list(@Query('cityCode') cityCode?: string) {
return this.storeService.listOpenStores(cityCode);
}
@Get(':id')
detail(@Param('id') id: string) {
return this.storeService.getStore(BigInt(id));
}
}
@Controller('partner/stores')
@UseGuards(JwtAuthGuard)
export class PartnerStoreController {
constructor(private readonly storeService: StoreService) {}
@Get()
list(@CurrentUser() user: AuthUser) {
return this.storeService.partnerListStores(user.actorId);
}
@Post()
create(@CurrentUser() user: AuthUser, @Body() body: Record<string, unknown>) {
return this.storeService.createStore(user.actorId, body);
}
}
@Controller('partner/dashboard')
@UseGuards(JwtAuthGuard)
export class PartnerDashboardController {
constructor(private readonly storeService: StoreService) {}
@Get()
dashboard(@CurrentUser() user: AuthUser) {
return this.storeService.partnerDashboard(user.actorId);
}
}
@Controller('shop/store')
@UseGuards(JwtAuthGuard)
export class ShopStoreController {
constructor(private readonly storeService: StoreService) {}
@Get()
info(@CurrentUser() user: AuthUser) {
return this.storeService.getShopStore(user.actorId);
}
@Put('status')
status(@CurrentUser() user: AuthUser, @Body() body: { status: 'OPEN' | 'PAUSED' }) {
return this.storeService.updateShopStatus(user.actorId, body.status);
}
}
@Controller('shop/dashboard')
@UseGuards(JwtAuthGuard)
export class ShopDashboardController {
constructor(private readonly redeemService: RedeemService) {}
@Get()
async dashboard(@CurrentUser() user: AuthUser) {
return this.redeemService.getShopDashboard(user.actorId);
}
}