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