Skip to content

Commit

Permalink
RI-203: permet de valider une offre et les groupes
Browse files Browse the repository at this point in the history
  • Loading branch information
nekorpeche committed Dec 11, 2021
1 parent 806ac52 commit 764fba3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ResponseEntity<GroupDto> createSubreddit(@RequestBody GroupDto group) {
return ResponseEntity.status(CREATED).body(saveDto);
}

@GetMapping(VALIDATED_GROUPS_URI)
@GetMapping(GET_VALIDATED_GROUPS_URI)
public ResponseEntity<Page<GroupDto>> getAllValidGroups(
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "rows", defaultValue = "10") int rows,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ApiUrls {
public static final String CREATE_NO_IMAGE = "/no-image";
public static final String GET_PENDING_GROUP_URI = "/pending";
public static final String VALIDATE_GROUP_URI = "/validate";
public static final String VALIDATED_GROUPS_URI = "/validated";
public static final String GET_VALIDATED_GROUPS_URI = "/validated";

// COMMENTS
public static final String COMMENTS_BASE_URI = "/api/comments";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void should_list_all_subreddit_with_no_authentication() throws Exception {
given(userRepository.findById(any())).willReturn(Optional.of(user));

// when
final ResultActions resultActions = mvc.perform(get(GROUPS_BASE_URI + VALIDATED_GROUPS_URI).contentType(APPLICATION_JSON));
final ResultActions resultActions = mvc.perform(get(GROUPS_BASE_URI + GET_VALIDATED_GROUPS_URI).contentType(APPLICATION_JSON));

// then
resultActions.andDo(print())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Component} from '@angular/core';
import {BaseWithPaginationComponent} from '../../../shared/components/base-with-pagination/base-with-pagination.component';
import {Group} from '../../../discussion/model/group';
import {SortDirectionEnum} from '../../../shared/enums/sort-direction.enum';
import {ActivatedRoute} from '@angular/router';
import {ToasterService} from '../../../core/services/toaster.service';
import {GroupService} from '../../../discussion/services/group.service';
Expand Down Expand Up @@ -31,9 +30,7 @@ export class PendingGroupTableComponent extends BaseWithPaginationComponent<Grou
this.groupService
.validateGroup(group)
.subscribe(
(data) => {
this.paginate({first: this.pageable.first, rows: this.pageable.rows});
},
() => this.paginate(this.pageable),
() => this.toastService.error('Oops', `Une erreur est survenue lors de la validation du groupe.`),
() => this.toastService.success('Succès', `Le groupe ${group.name} est désormais validé.`),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class PendingJobTableComponent extends BaseWithPaginationComponent<JobPos
this.jobsService
.validateJob(job)
.subscribe(
() => this.paginate({first: this.pageable.first, rows: this.pageable.rows}),
() => this.paginate(this.pageable),
() => this.toastService.error('Oops', `Une erreur est survenue lors de la validation de l'offre.`),
() => this.toastService.success('Succès', `L'offre ${job.title} est désormais validée.`),
);
Expand Down

0 comments on commit 764fba3

Please sign in to comment.