@@ -32,8 +32,8 @@ public static void ConfigureAuthApi(this WebApplication app)
3232 {
3333 var users = app . MapGroup ( "users" ) ;
3434 users . MapPost ( "/" , Register ) . WithSummary ( "Create user" ) ; //OKOKOK
35- users . MapGet ( "/by_cohortcourse/{id }" , GetUsersByCohortCourse ) . WithSummary ( "Get all users from a cohortCourse" ) ; //OKOKOK
36- users . MapGet ( "/by_cohort/{id }" , GetUsersByCohort ) . WithSummary ( "Get all users from a cohort" ) ; //OKOKOK
35+ users . MapGet ( "/by_cohortcourse/{cc_id }" , GetUsersByCohortCourse ) . WithSummary ( "Get all users from a cohortCourse" ) ; //OKOKOK
36+ users . MapGet ( "/by_cohort/{cohort_id }" , GetUsersByCohort ) . WithSummary ( "Get all users from a cohort" ) ; //OKOKOK
3737 users . MapGet ( "/" , GetUsers ) . WithSummary ( "Get all users or filter by first name, last name or full name" ) ; //OKOKOK
3838 users . MapGet ( "/{id}" , GetUserById ) . WithSummary ( "Get user by user id" ) ; //OKOKOK
3939 app . MapPost ( "/login" , Login ) . WithSummary ( "Localhost Login" ) ; //OKOKOK
@@ -96,7 +96,18 @@ private static async Task<IResult> GetUsersByCohort(IRepository<Cohort> reposito
9696 var results = response . CohortCourses . SelectMany ( a => a . UserCCs ) . Select ( a => a . User ) . ToList ( ) ;
9797 var dto_results = results . Select ( a => new UserDTO ( a ) ) ;
9898
99- return TypedResults . Ok ( dto_results ) ;
99+ var userData = new UsersSuccessDTO
100+ {
101+ Users = results . Select ( u => new UserDTO ( u ) ) . ToList ( ) //if teacher loads students, also load notes for students.
102+ } ;
103+
104+ var responseObject = new ResponseDTO < UsersSuccessDTO >
105+ {
106+ Status = "success" ,
107+ Data = userData
108+ } ;
109+
110+ return TypedResults . Ok ( responseObject ) ;
100111 }
101112
102113 [ ProducesResponseType ( StatusCodes . Status200OK ) ]
0 commit comments