mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: limit sdoc payload
This commit is contained in:
1 parent
22201794ce
commit
340b02bbf2
4 files changed
+8
-11
No files matched your search
@@ -82,8 +82,11 @@ class TokenModel {
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
static async getMostRecentSessionByUid(uid: number) {
|
||||
return await TokenModel.coll.findOne({ uid, tokenType: TokenModel.TYPE_SESSION }, { sort: { updateAt: -1 } });
|
||||
static async getMostRecentSessionByUid(uid: number, projection: string[]) {
|
||||
return await TokenModel.coll.findOne(
|
||||
{ uid, tokenType: TokenModel.TYPE_SESSION },
|
||||
{ projection: { _id: 0, ...Object.fromEntries(projection.map((i) => [i, 1])) }, sort: { updateAt: -1 } },
|
||||
);
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
|
||||
Reference in new issue
Block a user