Skip to content

Commit ed66aa1

Browse files
authored
Upload guides (#7)
* infra * Upload guides UI * Upload to blob storage backend
1 parent 8626358 commit ed66aa1

File tree

28 files changed

+501
-172
lines changed

28 files changed

+501
-172
lines changed

.vscode/launch.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"AZURE_SERVICEBUS_NAMESPACE": "",
3030
"AZURE_SERVICEBUS_EMAIL_REQUEST_QUEUE_NAME": "",
3131
"AZURE_SERVICEBUS_EMAIL_RESPONSE_QUEUE_NAME": "",
32-
"CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE": ""
32+
"CONTOSO_SUPPORT_GUIDE_REQUEST_SERVICE": "",
33+
"AZURE_STORAGE_ACCOUNT_NAME": "",
34+
"AZURE_STORAGE_CONTAINER_NAME": ""
3335
}
3436
},
3537
{

apps/contoso-fiber/lombok.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
config.stopBubbling = true
2+
lombok.addLombokGeneratedAnnotation = true
3+
lombok.copyableAnnotations += org.springframework.beans.factory.annotation.Value

apps/contoso-fiber/pom.xml

Lines changed: 144 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
66

77
<parent>
88
<groupId>com.contoso.cams</groupId>
@@ -11,150 +11,155 @@
1111
<relativePath>../../pom.xml</relativePath>
1212
</parent>
1313

14-
<groupId>com.contoso</groupId>
15-
<artifactId>cams</artifactId>
16-
<version>0.0.1-SNAPSHOT</version>
17-
<name>cams</name>
18-
<description>Customer Account Management System</description>
19-
20-
<dependencies>
21-
<dependency>
22-
<groupId>org.springframework.cloud</groupId>
23-
<artifactId>spring-cloud-stream</artifactId>
24-
</dependency>
25-
<dependency>
26-
<groupId>org.springframework.boot</groupId>
27-
<artifactId>spring-boot-starter-web</artifactId>
28-
</dependency>
29-
<dependency>
30-
<groupId>org.springframework.boot</groupId>
31-
<artifactId>spring-boot-starter-thymeleaf</artifactId>
32-
</dependency>
33-
<dependency>
34-
<groupId>org.thymeleaf.extras</groupId>
35-
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
36-
</dependency>
37-
38-
<dependency>
39-
<groupId>org.springframework.boot</groupId>
40-
<artifactId>spring-boot-starter-security</artifactId>
41-
</dependency>
42-
<dependency>
43-
<groupId>com.azure.spring</groupId>
44-
<artifactId>spring-cloud-azure-starter-active-directory</artifactId>
45-
</dependency>
46-
<dependency>
47-
<groupId>org.springframework.boot</groupId>
48-
<artifactId>spring-boot-starter-oauth2-client</artifactId>
49-
</dependency>
50-
51-
<dependency>
52-
<groupId>org.springframework.boot</groupId>
53-
<artifactId>spring-boot-starter-data-jpa</artifactId>
54-
</dependency>
55-
<dependency>
56-
<groupId>org.postgresql</groupId>
57-
<artifactId>postgresql</artifactId>
58-
<scope>runtime</scope>
59-
</dependency>
60-
<dependency>
61-
<groupId>org.flywaydb</groupId>
62-
<artifactId>flyway-core</artifactId>
63-
</dependency>
64-
65-
<dependency>
14+
<groupId>com.contoso</groupId>
15+
<artifactId>cams</artifactId>
16+
<version>0.0.1-SNAPSHOT</version>
17+
<name>cams</name>
18+
<description>Customer Account Management System</description>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>org.springframework.cloud</groupId>
23+
<artifactId>spring-cloud-stream</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.springframework.boot</groupId>
27+
<artifactId>spring-boot-starter-web</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.thymeleaf.extras</groupId>
35+
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-security</artifactId>
41+
</dependency>
42+
<dependency>
43+
<groupId>com.azure.spring</groupId>
44+
<artifactId>spring-cloud-azure-starter-active-directory</artifactId>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.springframework.boot</groupId>
48+
<artifactId>spring-boot-starter-oauth2-client</artifactId>
49+
</dependency>
50+
51+
<dependency>
52+
<groupId>org.springframework.boot</groupId>
53+
<artifactId>spring-boot-starter-data-jpa</artifactId>
54+
</dependency>
55+
<dependency>
56+
<groupId>org.postgresql</groupId>
57+
<artifactId>postgresql</artifactId>
58+
<scope>runtime</scope>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.flywaydb</groupId>
62+
<artifactId>flyway-core</artifactId>
63+
</dependency>
64+
65+
<dependency>
6666
<groupId>org.springframework.boot</groupId>
6767
<artifactId>spring-boot-starter-cache</artifactId>
6868
</dependency>
69-
<dependency>
70-
<groupId>org.springframework.boot</groupId>
71-
<artifactId>spring-boot-starter-data-redis</artifactId>
72-
</dependency>
73-
<dependency>
74-
<groupId>org.springframework.session</groupId>
75-
<artifactId>spring-session-data-redis</artifactId>
76-
</dependency>
77-
78-
<dependency>
79-
<groupId>org.springframework.boot</groupId>
80-
<artifactId>spring-boot-starter-actuator</artifactId>
81-
</dependency>
82-
83-
<dependency>
84-
<groupId>org.springframework.boot</groupId>
85-
<artifactId>spring-boot-devtools</artifactId>
86-
<scope>runtime</scope>
87-
<optional>true</optional>
88-
</dependency>
89-
<dependency>
90-
<groupId>org.projectlombok</groupId>
91-
<artifactId>lombok</artifactId>
92-
<optional>true</optional>
93-
</dependency>
94-
<dependency>
95-
<groupId>org.springframework.boot</groupId>
96-
<artifactId>spring-boot-starter-test</artifactId>
97-
<scope>test</scope>
98-
</dependency>
99-
<dependency>
100-
<groupId>nz.net.ultraq.thymeleaf</groupId>
101-
<artifactId>thymeleaf-layout-dialect</artifactId>
102-
<version>3.2.1</version>
103-
</dependency>
104-
<dependency>
105-
<groupId>com.fasterxml.jackson.core</groupId>
106-
<artifactId>jackson-databind</artifactId>
107-
</dependency>
108-
109-
<dependency>
110-
<groupId>org.springframework.boot</groupId>
111-
<artifactId>spring-boot-starter-validation</artifactId>
112-
</dependency>
113-
114-
<dependency>
115-
<groupId>org.springframework.cloud</groupId>
116-
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
117-
</dependency>
118-
119-
<dependency>
120-
<groupId>org.springframework.boot</groupId>
121-
<artifactId>spring-boot-starter-aop</artifactId>
122-
</dependency>
69+
<dependency>
70+
<groupId>org.springframework.boot</groupId>
71+
<artifactId>spring-boot-starter-data-redis</artifactId>
72+
</dependency>
73+
<dependency>
74+
<groupId>org.springframework.session</groupId>
75+
<artifactId>spring-session-data-redis</artifactId>
76+
</dependency>
77+
78+
<dependency>
79+
<groupId>org.springframework.boot</groupId>
80+
<artifactId>spring-boot-starter-actuator</artifactId>
81+
</dependency>
82+
83+
<dependency>
84+
<groupId>org.springframework.boot</groupId>
85+
<artifactId>spring-boot-devtools</artifactId>
86+
<scope>runtime</scope>
87+
<optional>true</optional>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.projectlombok</groupId>
91+
<artifactId>lombok</artifactId>
92+
<optional>true</optional>
93+
</dependency>
94+
<dependency>
95+
<groupId>org.springframework.boot</groupId>
96+
<artifactId>spring-boot-starter-test</artifactId>
97+
<scope>test</scope>
98+
</dependency>
99+
<dependency>
100+
<groupId>nz.net.ultraq.thymeleaf</groupId>
101+
<artifactId>thymeleaf-layout-dialect</artifactId>
102+
<version>3.2.1</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>com.fasterxml.jackson.core</groupId>
106+
<artifactId>jackson-databind</artifactId>
107+
</dependency>
108+
109+
<dependency>
110+
<groupId>org.springframework.boot</groupId>
111+
<artifactId>spring-boot-starter-validation</artifactId>
112+
</dependency>
113+
114+
<dependency>
115+
<groupId>org.springframework.cloud</groupId>
116+
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
117+
</dependency>
118+
119+
<dependency>
120+
<groupId>org.springframework.boot</groupId>
121+
<artifactId>spring-boot-starter-aop</artifactId>
122+
</dependency>
123123

124124
<dependency>
125125
<groupId>org.apache.commons</groupId>
126126
<artifactId>commons-lang3</artifactId>
127127
</dependency>
128128

129-
<dependency>
130-
<groupId>com.azure.spring</groupId>
131-
<artifactId>spring-cloud-azure-stream-binder-servicebus</artifactId>
132-
</dependency>
133-
134-
<dependency>
135-
<groupId>com.contoso.cams</groupId>
136-
<artifactId>proto</artifactId>
137-
<version>1.0.0-SNAPSHOT</version>
138-
</dependency>
139-
140-
</dependencies>
141-
142-
<build>
143-
<finalName>cams</finalName>
144-
<plugins>
145-
<plugin>
146-
<groupId>org.springframework.boot</groupId>
147-
<artifactId>spring-boot-maven-plugin</artifactId>
148-
<configuration>
149-
<excludes>
150-
<exclude>
151-
<groupId>org.projectlombok</groupId>
152-
<artifactId>lombok</artifactId>
153-
</exclude>
154-
</excludes>
155-
</configuration>
156-
</plugin>
157-
</plugins>
158-
</build>
129+
<dependency>
130+
<groupId>com.azure.spring</groupId>
131+
<artifactId>spring-cloud-azure-stream-binder-servicebus</artifactId>
132+
</dependency>
133+
134+
<dependency>
135+
<groupId>com.contoso.cams</groupId>
136+
<artifactId>proto</artifactId>
137+
<version>1.0.0-SNAPSHOT</version>
138+
</dependency>
139+
140+
<dependency>
141+
<groupId>com.azure.spring</groupId>
142+
<artifactId>spring-cloud-azure-starter-storage-blob</artifactId>
143+
</dependency>
144+
145+
</dependencies>
146+
147+
<build>
148+
<finalName>cams</finalName>
149+
<plugins>
150+
<plugin>
151+
<groupId>org.springframework.boot</groupId>
152+
<artifactId>spring-boot-maven-plugin</artifactId>
153+
<configuration>
154+
<excludes>
155+
<exclude>
156+
<groupId>org.projectlombok</groupId>
157+
<artifactId>lombok</artifactId>
158+
</exclude>
159+
</excludes>
160+
</configuration>
161+
</plugin>
162+
</plugins>
163+
</build>
159164

160165
</project>

apps/contoso-fiber/src/main/java/com/contoso/cams/CamsApplication.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,17 @@ public class ExceptionHandlerControllerAdvice extends ResponseEntityExceptionHan
3333
private static final Logger log = LoggerFactory.getLogger(ExceptionHandlerControllerAdvice.class);
3434

3535
@ExceptionHandler(AccessDeniedException.class)
36-
public ProblemDetail exceptionHandler(Exception ex) {
36+
public ProblemDetail exceptionHandler(AccessDeniedException ex) {
3737
log.error("Access Denied error", ex);
3838
ProblemDetail pd = ProblemDetail.forStatusAndDetail(HttpStatus.FORBIDDEN, "You do not have permission to access this resource.");
3939
return pd;
4040
}
41+
42+
@ExceptionHandler(Exception.class)
43+
public ProblemDetail allExceptionHandler(Exception ex) {
44+
log.error("Exception", ex);
45+
ProblemDetail pd = ProblemDetail.forStatusAndDetail(HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage());
46+
return pd;
47+
}
4148
}
4249
}

apps/contoso-fiber/src/main/java/com/contoso/cams/model/SupportGuide.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
public class SupportGuide {
1515

1616
@Id
17-
@Column(name = "activity_type_id", nullable = false, updatable = false)
17+
@Column(name = "support_guide_id", nullable = false, updatable = false)
1818
@GeneratedValue(strategy = GenerationType.IDENTITY)
1919
private Long id;
2020

21-
@Column(name = "name", nullable = false)
21+
@Column(name = "name", nullable = false, unique = true)
2222
private String name;
2323

2424
@Column(name = "description", nullable = false)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package com.contoso.cams.model;
22

3+
import java.util.Optional;
4+
35
import org.springframework.data.jpa.repository.JpaRepository;
46

57
public interface SupportGuideRepository extends JpaRepository<SupportGuide, Long> {
8+
9+
Optional<SupportGuide> findByName(String name);
610
}

apps/contoso-fiber/src/main/java/com/contoso/cams/support/SupportCaseService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public void emailGuide(Long id, Long guideId) {
215215
}
216216

217217
private void createEmailSupportCaseActivity(SupportCase supportCase, SupportGuide supportGuide) {
218-
final String notes = "Emailing support guide " + supportGuide.getName();
218+
final String notes = "Emailing support guide " + supportGuide.getUrl();
219219
final ActivityType activityType = ActivityType.OUTBOUND_EMAIL;
220220

221221
SupportCaseActivity supportCaseActivity = new SupportCaseActivity();

0 commit comments

Comments
 (0)