Skip to content

Commit 64aeb3a

Browse files
committed
update readme
1 parent fe9a3cf commit 64aeb3a

1 file changed

Lines changed: 50 additions & 17 deletions

File tree

README.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,33 @@ A RESTful API for managing tasks built with Java 21 and Spring Boot.
1111

1212
## Tech Stack
1313

14-
| Layer | Technology |
15-
|----------------|------------------------|
16-
| Language | Java 21 |
17-
| Framework | Spring Boot 4.1.0-M2 |
18-
| Persistence | H2 (file-based) |
19-
| ORM | Spring Data JPA |
20-
| Validation | Spring Boot Validation |
21-
| Error Handling | @ControllerAdvice |
22-
| Monitoring | Spring Actuator |
23-
| Build Tool | Maven |
24-
| CI/CD | GitHub Actions |
14+
| Layer | Technology |
15+
|----------------|----------------------------------|
16+
| Language | Java 21 |
17+
| Framework | Spring Boot 4.1.0-M2 |
18+
| Persistence | H2 (file-based) |
19+
| ORM | Spring Data JPA |
20+
| Validation | Spring Boot Validation |
21+
| Error Handling | @ControllerAdvice |
22+
| Eventing | Spring ApplicationEventPublisher |
23+
| Monitoring | Spring Actuator |
24+
| Build Tool | Maven |
25+
| CI/CD | GitHub Actions |
2526

2627
---
2728

2829
## Getting Started
2930

3031
**Prerequisites:** Java 21+ (Maven wrapper included)
32+
3133
```bash
3234
git clone https://github.com/ColtonRandall/task-manager-api.git
3335
cd task-manager-api
3436
./mvnw spring-boot:run
3537
```
3638

3739
The API starts on `http://localhost:8080`. To build a JAR:
40+
3841
```bash
3942
./mvnw -B package
4043
java -jar target/task-manager-api-0.0.1-SNAPSHOT.jar
@@ -50,6 +53,7 @@ java -jar target/task-manager-api-0.0.1-SNAPSHOT.jar
5053
| `prod` | H2 console disabled, DDL validate only |
5154

5255
The active profile is set in `application.properties`. In a real deployment, override it via environment variable:
56+
5357
```bash
5458
SPRING_PROFILES_ACTIVE=prod
5559
```
@@ -86,28 +90,33 @@ The H2 console is available in the `dev` profile at `http://localhost:8080/h2-co
8690
### Examples
8791

8892
**Create a task**
93+
8994
```bash
9095
curl -s -X POST http://localhost:8080/tasks \
9196
-H "Content-Type: application/json" \
9297
-d '{"name":"Buy groceries","description":"Milk, eggs, bread"}'
9398
```
9499

95100
**Get all tasks**
101+
96102
```bash
97103
curl -s http://localhost:8080/tasks
98104
```
99105

100106
**Complete a task**
107+
101108
```bash
102109
curl -s -X PATCH http://localhost:8080/tasks/{id}/complete
103110
```
104111

105112
**Delete a task (soft delete)**
113+
106114
```bash
107115
curl -s -X DELETE http://localhost:8080/tasks/{id}
108116
```
109117

110118
**Undo a deleted task**
119+
111120
```bash
112121
curl -s -X PATCH http://localhost:8080/tasks/{id}
113122
```
@@ -117,6 +126,7 @@ curl -s -X PATCH http://localhost:8080/tasks/{id}
117126
## Error Handling
118127

119128
All errors return a consistent JSON response:
129+
120130
```json
121131
{
122132
"error": "Task not found: abc-123",
@@ -125,12 +135,27 @@ All errors return a consistent JSON response:
125135
}
126136
```
127137

128-
| Scenario | Status |
129-
|---------------------------|--------|
130-
| Task not found | 404 |
131-
| Invalid request body | 400 |
132-
| Invalid status value | 400 |
133-
| Unexpected server error | 500 |
138+
| Scenario | Status |
139+
|-------------------------|--------|
140+
| Task not found | 404 |
141+
| Invalid request body | 400 |
142+
| Invalid status value | 400 |
143+
| Unexpected server error | 500 |
144+
145+
---
146+
147+
## Eventing
148+
149+
The following events are published when task state changes:
150+
151+
| Event | Trigger |
152+
|----------------------|----------------------|
153+
| `TaskCreatedEvent` | Task created |
154+
| `TaskCompletedEvent` | Task marked complete |
155+
| `TaskDeletedEvent` | Task soft deleted |
156+
157+
Events are handled by `TaskEventListener` which logs each state change. The listener is decoupled from the service —
158+
additional listeners (e.g. a Kinesis producer) can be added without modifying `TaskService`.
134159

135160
---
136161

@@ -147,13 +172,15 @@ Spring Actuator exposes a health endpoint at `http://localhost:8080/actuator/hea
147172
---
148173

149174
## Tests
175+
150176
```bash
151177
./mvnw test
152178
```
153179

154180
---
155181

156182
## Project Structure
183+
157184
```
158185
src/
159186
├── main/
@@ -171,6 +198,12 @@ src/
171198
│ │ │ └── TaskStatus.java
172199
│ │ ├── repository/
173200
│ │ │ └── TaskRepository.java
201+
│ │ ├── event/
202+
│ │ │ ├── TaskCreatedEvent.java
203+
│ │ │ ├── TaskCompletedEvent.java
204+
│ │ │ └── TaskDeletedEvent.java
205+
│ │ ├── listener/
206+
│ │ │ └── TaskEventListener.java
174207
│ │ ├── service/
175208
│ │ │ └── TaskService.java
176209
│ │ └── TaskManagerApiApplication.java

0 commit comments

Comments
 (0)