feat: add link to user from session list

This commit is contained in:
Justin Lin committed 2026-10-09 23:54:32 +11:00
1 parent 994618f71c
commit accfbc620c
3 files changed
+5 -4

No files matched your search

+2 -1
View File
@@ -1,6 +1,7 @@
import { Types } from 'mongoose'
export interface User {
_id: string
username: string
}
export interface SessionDocument {
@@ -23,7 +24,7 @@ export interface CommandObject {
}
export interface SessionObject {
_id: Types.ObjectId
user: string
user: User
quest: string
locale: string
status: string
+2 -2
View File
@@ -54,7 +54,7 @@ export async function sessionList(
} = session
return {
_id,
user: user.username, // Assuming `user` is always populated.
user: { _id: user._id, username: user.username },
quest,
locale: locale ?? 'zh-TW',
status,
@@ -98,7 +98,7 @@ export async function sessionDetail(id: string): Promise<SessionDetail> {
console.log('session: ', session)
return {
_id,
user: user.username,
user: { _id: user._id, username: user.username },
quest,
locale: locale ?? 'zh-TW',
status,
+1 -1
View File
@@ -22,7 +22,7 @@
</tr>
{{#each sessions}}
<tr>
<td>{{user}}</td>
<td><a href="/users/{{user._id}}">{{user.username}}</a></td>
<td>{{quest}}</td>
<td>{{locale}}</td>
<td>{{status}}</td>