Skip to content

Commit a89d31a

Browse files
authored
Push the context based packaging to the template as well, with paragraph in the readme (#11)
1 parent 8d84fa3 commit a89d31a

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,19 @@ For e2e testing, you can use Cypress. To run the e2e tests, follow these steps:
3838
2. Run the e2e tests:
3939
```bash
4040
pnpm e2e
41-
```
41+
```
42+
43+
# Naming convention
44+
## Packages
45+
We use a context based java package structure. That means a package for each context. This is spelled singular, eg: 'user', not 'users'. Some goes for the
46+
classes in that package. We try to group classes that belong to the same context. For instance: the keycloak admin service is placed in the user package since
47+
it's used there. This can always change if the project grows and it's used in other places as well.\
48+
This can of course apply to sub-packages as well. If the 'pod' package grows too big, we can create sub-packages like 'management', 'deployment', etc.
49+
50+
In the frontend this can be applied as well.
51+
52+
## DTO / data transfer objects
53+
We try to use DTO's as much as possible. This means that we don't expose our entities or internal classes directly. This implies that we create classes
54+
(or records whenever possible). There are two types of DTO's:
55+
* a 'command' - to create or update data - typically these are named like `CreateUserCommand`
56+
* a 'response' - to return data to the client - typically these are named like `UserDto`

src/main/java/org/frankframework/application/models/TestResponse.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/main/java/org/frankframework/application/endpoints/TestController.java renamed to src/main/java/org/frankframework/application/test/TestController.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
package org.frankframework.application.endpoints;
1+
package org.frankframework.application.test;
22

33

4-
import org.frankframework.application.models.TestResponse;
54
import org.springframework.http.ResponseEntity;
65
import org.springframework.web.bind.annotation.GetMapping;
76
import org.springframework.web.bind.annotation.RequestMapping;
@@ -11,7 +10,7 @@
1110
@RequestMapping("/test")
1211
public class TestController {
1312
@GetMapping
14-
public ResponseEntity<TestResponse> test() {
15-
return ResponseEntity.ok(new TestResponse("Hello World!"));
13+
public ResponseEntity<TestDto> test() {
14+
return ResponseEntity.ok(new TestDto("Hello World!"));
1615
}
1716
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package org.frankframework.application.test;
2+
3+
public record TestDto(String data) {
4+
}

0 commit comments

Comments
 (0)