diff --git a/back/src/wos/wos.controller.ts b/back/src/wos/wos.controller.ts index 5b94db8..b47bfcd 100644 --- a/back/src/wos/wos.controller.ts +++ b/back/src/wos/wos.controller.ts @@ -17,6 +17,11 @@ export class WosController { return this.wosService.redeemAll(body.fid); } + @Get('users') + async listUsers() { + return this.wosService.listUsers(); + } + @Get('history/:fid') async getHistory(@Param('fid') fid: string) { return this.wosService.getHistory(fid); diff --git a/back/src/wos/wos.service.ts b/back/src/wos/wos.service.ts index f50cb08..198324b 100644 --- a/back/src/wos/wos.service.ts +++ b/back/src/wos/wos.service.ts @@ -154,6 +154,10 @@ export class WosService { }); } + async listUsers() { + return this.wosUserRepo.find({ order: { created_at: 'DESC' } }); + } + async listCoupons() { return this.wosCouponRepo.find({ order: { created_at: 'DESC' } }); } diff --git a/front/src/stores/wos.store.ts b/front/src/stores/wos.store.ts index c47a571..1084a6d 100644 --- a/front/src/stores/wos.store.ts +++ b/front/src/stores/wos.store.ts @@ -30,6 +30,13 @@ export interface Coupon { created_at: string; } +export interface SavedUser { + fid: string; + nickname: string; + avatar_url: string; + created_at: string; +} + export const useWosStore = defineStore('wos', { state: () => ({ fid: '', @@ -37,6 +44,7 @@ export const useWosStore = defineStore('wos', { results: [] as RedeemResult[], history: [] as HistoryItem[], coupons: [] as Coupon[], + savedUsers: [] as SavedUser[], status: 'idle' as 'idle' | 'loading' | 'success' | 'error', errorMsg: '', }), @@ -78,6 +86,13 @@ export const useWosStore = defineStore('wos', { } catch {} }, + async loadSavedUsers() { + try { + const { data } = await axios.get('/api/users'); + this.savedUsers = data; + } catch {} + }, + async loadCoupons() { try { const { data } = await axios.get('/api/coupons'); diff --git a/front/src/views/HomeView.vue b/front/src/views/HomeView.vue index 3e52f47..c3a12d4 100644 --- a/front/src/views/HomeView.vue +++ b/front/src/views/HomeView.vue @@ -21,6 +21,22 @@
{{ store.errorMsg }}
+ +