File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @ccw-api/api" ,
3- "version" : " 1 .0.6 " ,
3+ "version" : " 2 .0.0 " ,
44 "description" : " ccw api collections" ,
55 "license" : " MIT" ,
66 "author" : " Meng Fuzi" ,
Original file line number Diff line number Diff line change @@ -5,6 +5,18 @@ import assert from "node:assert/strict";
55const STUDENT_OID = "63c2807d669fa967f17f5559" ;
66
77test ( "get student profile" , async ( ) => {
8- const profile = await getStudentProfile ( STUDENT_OID ) ;
9- assert . strictEqual ( profile . studentOid , ( STUDENT_OID ) , "expected values to be strictly equal" ) ;
8+ const profile = await getStudentProfile ( { studentOid : STUDENT_OID } ) ;
9+ assert . strictEqual (
10+ profile . studentOid ,
11+ STUDENT_OID ,
12+ "expected values to be strictly equal" ,
13+ ) ;
14+ const profile2 = await getStudentProfile ( {
15+ studentNumber : profile . studentNumber ,
16+ } ) ;
17+ assert . strictEqual (
18+ profile2 . studentOid ,
19+ STUDENT_OID ,
20+ "expected values to be strictly equal" ,
21+ ) ;
1022} ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import { StudentProfile } from "src/types/userData";
55export const url = "https://community-web.ccw.site/students/profile" ;
66
77export type Req = {
8- studentOid : MongoDBId ;
8+ studentNumber ?: string ;
9+ studentOid ?: MongoDBId ;
910} ;
1011
1112export type Res = StudentProfile ;
@@ -15,8 +16,14 @@ export type Res = StudentProfile;
1516 * @param {MongoDBId } studentOid 学生id
1617 * @returns {Promise<Res> } 学生资料
1718 */
18- export async function getStudentProfile ( studentOid : MongoDBId ) : Promise < Res > {
19- const req : Req = { studentOid } ;
19+ export async function getStudentProfile ( {
20+ studentOid,
21+ studentNumber,
22+ } : {
23+ studentNumber ?: string ;
24+ studentOid ?: MongoDBId ;
25+ } ) : Promise < Res > {
26+ const req : Req = { studentOid, studentNumber } ;
2027 return await request
2128 . post < ApiResponse < Res > > ( url , req )
2229 . then ( ( res ) => res . data . body ) ;
You can’t perform that action at this time.
0 commit comments