public async Task <IActionResult> GetAllUsers([FromQuery] GetPublicUsersQuery query)
        {
            var users = await Mediator.Send(query);

            var usersWithLinks = users.Select(user =>
                                              new HateoasResponse <PublicUser>(user, GetLinksForUser(user.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          users.ToPagedListResume(),
                          usersWithLinks.ToList(),
                          nameof(GetAllUsers))));
        }
Exemple #2
0
        public async Task <IActionResult> GetTournaments([FromQuery] GetTournamentNavigationPaginatedQuery query)
        {
            var tournaments = await Mediator.Send(query);

            var tournamentsWithLinks = tournaments.Select(tournament =>
                                                          new HateoasResponse <TournamentNavigation>(tournament, GetLinksForTournament(tournament.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          tournaments.ToPagedListResume(),
                          tournamentsWithLinks.ToList(),
                          nameof(GetTournaments))
                      ));
        }
        public async Task <IActionResult> GetRights([FromQuery] GetPaginatedRightNavigationsQuery query)
        {
            var rights = await Mediator.Send(query);

            var rightsWithLinks = rights.Select(right =>
                                                new HateoasResponse <RightNavigation>(right, GetLinksForRight(right.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          rights.ToPagedListResume(),
                          rightsWithLinks.ToList(),
                          nameof(GetRights))
                      ));
        }
        public async Task <IActionResult> GetSteps([FromQuery] GetPaginatedStepNavigationQuery query)
        {
            var steps = await Mediator.Send(query);

            var stepsWithLinks = steps.Select(step =>
                                              new HateoasResponse <StepNavigation>(step, GetLinksForStep(step.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          steps.ToPagedListResume(),
                          stepsWithLinks.ToList(),
                          nameof(GetSteps))
                      ));
        }
        public async Task <IActionResult> GetTeams([FromQuery] GetTeamNavigationPaginatedQuery query)
        {
            var teams = await Mediator.Send(query);

            var teamsWithLinks = teams.Select(team =>
                                              new HateoasResponse <TeamNavigation>(team, GetLinksForTeam(team.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          teams.ToPagedListResume(),
                          teamsWithLinks.ToList(),
                          nameof(GetTeams))
                      ));
        }
Exemple #6
0
        public async Task <IActionResult> GetLanguages([FromQuery] GetAllProgrammingLanguagesPaginatedQuery query)
        {
            var languages = await Mediator.Send(query);

            var languagesWithLinks = languages.Select(language =>
                                                      new HateoasResponse <ProgrammingLanguageNavigation>(language, GetLinksForLanguage(language.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          languages.ToPagedListResume(),
                          languagesWithLinks.ToList(),
                          nameof(GetLanguages))
                      ));
        }
        public async Task <IActionResult> GetPaginatedSuspectFunctionsFiltered(
            [FromQuery] GetSuspectFunctionsPaginatedQuery query)
        {
            var functions = await Mediator.Send(query);

            var functionsWithLinks = functions.Select(function =>
                                                      new HateoasResponse <SuspectFunctionNavigation>(function, GetLinksForFunction(function.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          functions.ToPagedListResume(),
                          functionsWithLinks.ToList(),
                          nameof(GetPaginatedSuspectFunctionsFiltered))
                      ));
        }
Exemple #8
0
        public async Task <IActionResult> GetParticipations(
            [FromQuery] GetAllParticipationNavigationPaginatedQuery query)
        {
            var participations = await Mediator.Send(query);

            var participationsWithLinks = participations.Select(participation =>
                                                                new HateoasResponse <ParticipationNavigation>(participation,
                                                                                                              GetLinksForParticipation(participation.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          participations.ToPagedListResume(),
                          participationsWithLinks.ToList(),
                          nameof(GetParticipations))
                      ));
        }
        public async Task <IActionResult> GetTeamTournaments(Guid teamId,
                                                             [FromQuery] PaginationQueryBase query)
        {
            var tournaments = await Mediator.Send(new GetTournamentNavigationPaginatedQuery
                                                  { TeamId = teamId, Page = query.Page, Size = query.Size });

            var tournamentsWithLinks = tournaments.Select(tournament =>
                                                          new HateoasResponse <TournamentNavigation>(tournament, GetLinksForTournament(tournament.Id, teamId)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          tournaments.ToPagedListResume(),
                          tournamentsWithLinks.ToList(),
                          nameof(GetTeamTournaments))
                      ));
        }
        public async Task <IActionResult> GetMembers(Guid teamId,
                                                     [FromQuery] GetPaginatedTeamMembersQueryParameters query)
        {
            var members = await Mediator.Send(new GetPaginatedTeamMembersQuery
                                              { TeamId = teamId, Page = query.Page, Size = query.Size });

            var teamsWithLinks = members.Select(member =>
                                                new HateoasResponse <MemberNavigation>(member, GetLinksForMember(member.UserId, member.TeamId)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          members.ToPagedListResume(),
                          teamsWithLinks.ToList(),
                          nameof(GetMembers))
                      ));
        }
Exemple #11
0
        public async Task <IActionResult> GetUsers(Guid participationId, [FromQuery] PaginationQueryBase query)
        {
            var users = await Mediator.Send(new GetParticipationSessionUsersPaginatedQuery
                                            { ParticipationId = participationId, Page = query.Page, Size = query.Size });

            var usersWithLinks = users.Select(user =>
                                              new HateoasResponse <UserSessionNavigation>(user,
                                                                                          GetLinksForUser(participationId, user.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          users.ToPagedListResume(),
                          usersWithLinks.ToList(),
                          nameof(GetUsers))
                      ));
        }
        public async Task <IActionResult> GetTeamParticipationsByTournament(Guid teamId, Guid tournamentId,
                                                                            [FromQuery] PaginationQueryBase query)
        {
            var participations = await Mediator.Send(new GetAllParticipationNavigationPaginatedQuery
                                                     { TeamIdFilter = teamId, TournamentIdFilter = tournamentId, Page = query.Page, Size = query.Size });

            var participationsWithLinks = participations.Select(participation =>
                                                                new HateoasResponse <ParticipationNavigation>(participation,
                                                                                                              GetLinksForParticipation(tournamentId, teamId, participation.StepId)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          participations.ToPagedListResume(),
                          participationsWithLinks.ToList(),
                          nameof(GetTeamParticipationsByTournament))
                      ));
        }
Exemple #13
0
        public async Task <IActionResult> GetFunctions(Guid participationId,
                                                       [FromQuery] GetParticipationSessionFunctionsPaginatedQueryParameters query)
        {
            var functions = await Mediator.Send(new GetParticipationSessionFunctionsPaginatedQuery
            {
                ParticipationId    = participationId, Page = query.Page, Size = query.Size,
                FunctionsIdsFilter = query.FunctionsIdsFilter
            });

            var functionsWithLinks = functions.Select(function =>
                                                      new HateoasResponse <FunctionSessionNavigation>(function,
                                                                                                      GetLinksForFunction(participationId, function.Id)));

            return(Ok(HateoasResponseBuilder.FromPagedList(
                          Url,
                          functions.ToPagedListResume(),
                          functionsWithLinks.ToList(),
                          nameof(GetFunctions))
                      ));
        }