Skip to content

Commit f772038

Browse files
committed
refactor api contract (adding name of ministry to the models), update the backend to implement the logic (in mapper, service, controller, and in the entity)
1 parent c46be1f commit f772038

File tree

7 files changed

+57
-19
lines changed

7 files changed

+57
-19
lines changed

api-contract/src/main/resources/api-contract.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ components:
9696
description: Name of the Representative entity
9797
type: string
9898
example: 'Vadász Csaba'
99+
government:
100+
description: Name of the Ministry
101+
type: string
102+
example: "Miniszterelnökség"
99103
jobTitle:
100104
description: Job title of the Government Representative
101105
type: string
@@ -134,6 +138,10 @@ components:
134138
description: Job title of the Government Representative
135139
type: string
136140
example: "Miniszterelnökséget vezető miniszter"
141+
government:
142+
description: Name of the Ministry
143+
type: string
144+
example: "Miniszterelnökség"
137145
address:
138146
description: Address of the Agency
139147
type: string

frontend/src/app/app.component.html

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,42 @@
44
<aside class="menu-sidebar d-none d-lg-block">
55
<div class="logo">
66
<a href="#">
7-
<img src="assets/images/logo.png" alt="luv2shop" class="img-responsive">
7+
<img src="assets/images/bp-logo.png" alt="bp" class="img-responsive">
88
</a>
99
</div>
1010
<div class="menu-sidebar-content js-scrollbar1">
1111
<nav class="navbar-sidebar">
1212
<ul class="list-unstyled navbar-list">
1313
<li>
14-
<a routerLink="/category/1" routerLinkActive="active-link">Books</a>
14+
<a routerLink="/category/1" routerLinkActive="active-link">Agrárminisztérium</a>
1515
</li>
1616
<li>
17-
<a routerLink="/category/2" routerLinkActive="active-link">Coffee Mugs</a>
17+
<a routerLink="/category/2" routerLinkActive="active-link">Belügyminisztérium</a>
1818
</li>
19-
<!--<li>
20-
<a href="#">Mouse Pads</a>
19+
<li>
20+
<a routerLink="/category/1" routerLinkActive="active-link">Emberi Erőforrások Minisztériuma</a>
21+
</li>
22+
<li>
23+
<a routerLink="/category/1" routerLinkActive="active-link">Honvédelmi Minisztérium</a>
24+
</li>
25+
<li>
26+
<a routerLink="/category/1" routerLinkActive="active-link">Igazságügyi Minisztérium</a>
27+
</li>
28+
<li>
29+
<a routerLink="/category/1" routerLinkActive="active-link">Innovációs és Technológiai Minisztérium</a>
2130
</li>
2231
<li>
23-
<a href="#">Luggage Tags</a>
24-
</li>-->
32+
<a routerLink="/category/1" routerLinkActive="active-link">Külgazdasági és Külügyminisztérium</a>
33+
</li>
34+
<li>
35+
<a routerLink="/category/1" routerLinkActive="active-link">Miniszterelnöki Kabinetiroda</a>
36+
</li>
37+
<li>
38+
<a routerLink="/category/1" routerLinkActive="active-link">Miniszterelnökség</a>
39+
</li>
40+
<li>
41+
<a routerLink="/category/1" routerLinkActive="active-link">Pénzügyminisztérium</a>
42+
</li>
2543
</ul>
2644
</nav>
2745
</div>
@@ -37,9 +55,9 @@
3755
<div class="header-wrap">
3856
<form class="form-header" onsubmit="return false;" method="GET">
3957
<input class="au-input au-input-xl" type="text" name="search"
40-
placeholder="Search for data ..." />
58+
placeholder="Adat keresés ..." />
4159
<button class="au-btn-submit" type="submit">
42-
Search
60+
Keresés
4361
</button>
4462
</form>
4563
<div class="cart-area d-n">
@@ -64,8 +82,9 @@
6482
<!-- END PAGE CONTAINER-->
6583
<footer>
6684
<ul>
67-
<li><a href="#">About Us</a></li>
68-
<li><a href="#">Contact Us</a></li>
69-
<li><a href="#">Help</a></li>
85+
<li><a href="#">Bemutatkozás</a></li>
86+
<li><a href="#">Kapcsolat</a></li>
87+
<li><a href="#">Szolgáltatások</a></li>
88+
<li><a href="#">Gyakori kérdések</a></li>
7089
</ul>
7190
</footer>
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
import { Component } from '@angular/core';
1+
import {Component, OnInit} from '@angular/core';
2+
import {GovernmentRepresentativeService} from "../../../../../build/openapi/governemnt-service";
23

34
@Component({
45
selector: 'app-representative-list',
56
templateUrl: './representative-list.component.html',
67
styleUrls: ['./representative-list.component.css']
78
})
8-
export class RepresentativeListComponent {
9+
export class RepresentativeListComponent implements OnInit {
910

11+
$representatives = this.representativeService.renderAllRepresentatives()
12+
constructor(private readonly representativeService: GovernmentRepresentativeService) {}
13+
14+
ngOnInit(): void {
15+
}
1016
}

government-service/src/main/java/com/csaba79coder/bestprotocol/controller/RepresentativeController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public class RepresentativeController implements GovernmentRepresentativeApi {
1919
private final RepresentativeService representativeService;
2020

2121
@Override
22-
public ResponseEntity<RepresentativeModel> addNewRepresentative(String name, String jobTitle, String address, String phoneNumber, String email, MultipartFile image, String note) {
23-
return ResponseEntity.status(201).body(representativeService.addNewRepresentative(name, jobTitle, address, phoneNumber, email, image, note));
22+
public ResponseEntity<RepresentativeModel> addNewRepresentative(String name, String jobTitle, String government, String address, String phoneNumber, String email, MultipartFile image, String note) {
23+
return ResponseEntity.status(201).body(representativeService.addNewRepresentative(name, jobTitle, government, address, phoneNumber, email, image, note));
2424
}
2525

2626
@Override

government-service/src/main/java/com/csaba79coder/bestprotocol/model/representative/entity/Representative.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public class Representative extends Auditable {
2626
@Column(name = "name")
2727
private String name;
2828

29+
@Column(name = "government")
30+
private String government;
31+
2932
@Column(name = "job_title")
3033
private String jobTitle;
3134

government-service/src/main/java/com/csaba79coder/bestprotocol/model/representative/service/RepresentativeService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public class RepresentativeService {
1616

1717
private final RepresentativeRepository representativeRepository;
1818

19-
public RepresentativeModel addNewRepresentative(String name, String jobTitle, String address, String phoneNumber, String email, MultipartFile image, String note) {
20-
return Mapper.mapRepresentativeEntityToModel(representativeRepository.save(Mapper.mapFieldIntoEntity(name, jobTitle, address, phoneNumber, email, image, note)));
19+
public RepresentativeModel addNewRepresentative(String name, String jobTitle, String government, String address, String phoneNumber, String email, MultipartFile image, String note) {
20+
return Mapper.mapRepresentativeEntityToModel(representativeRepository.save(Mapper.mapFieldIntoEntity(name, jobTitle, government, address, phoneNumber, email, image, note)));
2121
}
2222

2323
public List<RepresentativeModel> renderAllRepresentatives() {

government-service/src/main/java/com/csaba79coder/bestprotocol/util/mapper/Mapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ public class Mapper {
1313

1414
private static final ModelMapper modelMapper = new ModelMapper();
1515

16-
public static Representative mapFieldIntoEntity(String name, String jobTitle, String address, String phoneNumber, String email, MultipartFile image, String note) {
16+
public static Representative mapFieldIntoEntity(String name, String jobTitle, String government, String address, String phoneNumber, String email, MultipartFile image, String note) {
1717
Representative entity = new Representative();
1818
entity.setName(name);
1919
entity.setJobTitle(jobTitle);
20+
entity.setGovernment(government);
2021
entity.setAddress(address);
2122
entity.setPhoneNumber(phoneNumber);
2223
entity.setEmail(email);
@@ -40,6 +41,7 @@ public static RepresentativeModel mapRepresentativeEntityToModel(Representative
4041
.updatedBy(entity.getUpdatedBy())
4142
.name(entity.getName())
4243
.jobTitle(entity.getJobTitle())
44+
.government(entity.getGovernment())
4345
.address(entity.getAddress())
4446
.phoneNumber(entity.getPhoneNumber())
4547
.email(entity.getEmail())

0 commit comments

Comments
 (0)