mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: add link to user from session list
This commit is contained in:
1 parent
994618f71c
commit
accfbc620c
3 files changed
+5
-4
No files matched your search
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user