|
| 1 | +# Jira - Defect Management |
| 2 | + |
| 3 | +Jira - Defect Management is a Spring Boot application designed to manage and track defects (bugs) in software projects. This application provides a RESTful API for creating, updating, and retrieving defect information, as well as generating reports. |
| 4 | + |
| 5 | +## Technologies Used |
| 6 | + |
| 7 | +- **Spring Boot 3.2.2** |
| 8 | + - **Data JPA** |
| 9 | + - **Web** |
| 10 | + - **AOP** |
| 11 | + - **Devtools** |
| 12 | +- **H2 Database** (for testing) |
| 13 | +- **springdoc-openapi** 2.4.0 |
| 14 | +- **JUnit 5** |
| 15 | + - **junit-jupiter-api** |
| 16 | + - **junit-jupiter-engine** |
| 17 | +- **Mockito** 3.12.4 |
| 18 | +- **Lombok** |
| 19 | +- **SLF4J** 2.0.11 |
| 20 | +- **Logback** 1.4.14 |
| 21 | +- **Validation API** 2.0.1.Final |
| 22 | +- **Hibernate Validator** 7.0.2.Final |
| 23 | +- **MySQL Connector Java** 8.0.33 |
| 24 | +- **Jacoco** 0.8.7 |
| 25 | + |
| 26 | +## Getting Started |
| 27 | + |
| 28 | +### Prerequisites |
| 29 | + |
| 30 | +- Java 17 |
| 31 | +- Maven |
| 32 | +- MySQL |
| 33 | + |
| 34 | +### Setup |
| 35 | + |
| 36 | +1. **Clone the repository:** |
| 37 | + ```bash |
| 38 | + git clone https://github.com/yourusername/defects-management.git |
| 39 | + cd defects-management |
| 40 | + ``` |
| 41 | + |
| 42 | +2. **Configure the database:** |
| 43 | + |
| 44 | + Update the `application.properties` file with your MySQL database configuration. |
| 45 | + |
| 46 | + ```properties |
| 47 | + spring.datasource.url=jdbc:mysql://localhost:3306/yourdatabase |
| 48 | + spring.datasource.username=yourusername |
| 49 | + spring.datasource.password=yourpassword |
| 50 | + spring.jpa.hibernate.ddl-auto=update |
| 51 | + ``` |
| 52 | + |
| 53 | +3. **Build and run the application:** |
| 54 | + |
| 55 | + ```bash |
| 56 | + mvn clean install |
| 57 | + mvn spring-boot:run |
| 58 | + ``` |
| 59 | + |
| 60 | +4. **Access the API documentation:** |
| 61 | + |
| 62 | + Open your browser and go to `http://localhost:8080/swagger-ui.html` to view and interact with the API documentation. |
| 63 | + |
| 64 | +## API Endpoints |
| 65 | + |
| 66 | +### Authentication |
| 67 | + |
| 68 | +- **Authenticate User** |
| 69 | + - **URL:** `/api/users/login` |
| 70 | + - **Method:** `POST` |
| 71 | + - **Description:** Authenticate valid user credentials. |
| 72 | + - **Request Body:** |
| 73 | + ```json |
| 74 | + { |
| 75 | + "userName": "string", |
| 76 | + "password": "string" |
| 77 | + } |
| 78 | + ``` |
| 79 | + - **Response:** |
| 80 | + - **200 OK** |
| 81 | + ```json |
| 82 | + { |
| 83 | + "userName": "string", |
| 84 | + "password": "string", |
| 85 | + "role": "string", |
| 86 | + "accountLocked": false |
| 87 | + } |
| 88 | + ``` |
| 89 | + - **401 Unauthorized** |
| 90 | + ```json |
| 91 | + { |
| 92 | + "error": "Invalid username or password" |
| 93 | + } |
| 94 | + ``` |
| 95 | + |
| 96 | +### Defect Management |
| 97 | + |
| 98 | +- **Create a new defect** |
| 99 | + - **URL:** `/api/defects/new` |
| 100 | + - **Method:** `POST` |
| 101 | + - **Description:** Create a new defect. |
| 102 | + - **Request Body:** |
| 103 | + ```json |
| 104 | + { |
| 105 | + "title": "string", |
| 106 | + "defectdetails": "string", |
| 107 | + "stepstoreproduce": "string", |
| 108 | + "priority": "string", |
| 109 | + "detectedon": "YYYY-MM-DD", |
| 110 | + "expectedresolution": "YYYY-MM-DD", |
| 111 | + "reportedbytesterid": "string", |
| 112 | + "assignedtodeveloperid": "string", |
| 113 | + "severity": "string", |
| 114 | + "status": "string", |
| 115 | + "projectcode": "string", |
| 116 | + "resolutions": [ |
| 117 | + { |
| 118 | + "resolutiondate": "YYYY-MM-DD", |
| 119 | + "resolution": "string" |
| 120 | + } |
| 121 | + ] |
| 122 | + } |
| 123 | + ``` |
| 124 | + - **Response:** |
| 125 | + - **201 Created** |
| 126 | + ```json |
| 127 | + { |
| 128 | + "message": "Success" |
| 129 | + } |
| 130 | + ``` |
| 131 | + - **403 Forbidden** |
| 132 | + ```json |
| 133 | + { |
| 134 | + "error": "Maximum bug assignment limit reached for today." |
| 135 | + } |
| 136 | + ``` |
| 137 | + - **400 Bad Request** |
| 138 | + ```json |
| 139 | + { |
| 140 | + "error": "Error message" |
| 141 | + } |
| 142 | + ``` |
| 143 | + |
| 144 | +- **Update the status and provide resolution to a defect** |
| 145 | + - **URL:** `/api/defects/resolve` |
| 146 | + - **Method:** `PUT` |
| 147 | + - **Description:** Update the status and provide resolution to a defect. |
| 148 | + - **Request Body:** |
| 149 | + ```json |
| 150 | + { |
| 151 | + "id": 1, |
| 152 | + "status": "string", |
| 153 | + "resolutions": [ |
| 154 | + { |
| 155 | + "resolutiondate": "YYYY-MM-DD", |
| 156 | + "resolution": "string" |
| 157 | + } |
| 158 | + ] |
| 159 | + } |
| 160 | + ``` |
| 161 | + - **Response:** |
| 162 | + - **200 OK** |
| 163 | + ```json |
| 164 | + { |
| 165 | + "message": "Success" |
| 166 | + } |
| 167 | + ``` |
| 168 | + - **404 Not Found** |
| 169 | + ```json |
| 170 | + { |
| 171 | + "error": "Defect not found" |
| 172 | + } |
| 173 | + ``` |
| 174 | + |
| 175 | +- **Get defects assigned to a developer** |
| 176 | + - **URL:** `/api/defects/assignedto/{developerId}` |
| 177 | + - **Method:** `GET` |
| 178 | + - **Description:** Get defects based on DeveloperId. |
| 179 | + - **Response:** |
| 180 | + - **200 OK** |
| 181 | + ```json |
| 182 | + [ |
| 183 | + { |
| 184 | + "id": 1, |
| 185 | + "title": "string", |
| 186 | + "defectdetails": "string", |
| 187 | + "stepstoreproduce": "string", |
| 188 | + "priority": "string", |
| 189 | + "detectedon": "YYYY-MM-DD", |
| 190 | + "expectedresolution": "YYYY-MM-DD", |
| 191 | + "reportedbytesterid": "string", |
| 192 | + "assignedtodeveloperid": "string", |
| 193 | + "severity": "string", |
| 194 | + "status": "string", |
| 195 | + "projectcode": "string", |
| 196 | + "resolutions": [ |
| 197 | + { |
| 198 | + "id": 1, |
| 199 | + "defectId": 1, |
| 200 | + "resolutiondate": "YYYY-MM-DD", |
| 201 | + "resolution": "string" |
| 202 | + } |
| 203 | + ] |
| 204 | + } |
| 205 | + ] |
| 206 | + ``` |
| 207 | + |
| 208 | +- **Get defect details by ID** |
| 209 | + - **URL:** `/api/defects/{defectId}` |
| 210 | + - **Method:** `GET` |
| 211 | + - **Description:** Get defects based on Id. |
| 212 | + - **Response:** |
| 213 | + - **200 OK** |
| 214 | + ```json |
| 215 | + { |
| 216 | + "id": 1, |
| 217 | + "title": "string", |
| 218 | + "defectdetails": "string", |
| 219 | + "stepstoreproduce": "string", |
| 220 | + "priority": "string", |
| 221 | + "detectedon": "YYYY-MM-DD", |
| 222 | + "expectedresolution": "YYYY-MM-DD", |
| 223 | + "reportedbytesterid": "string", |
| 224 | + "assignedtodeveloperid": "string", |
| 225 | + "severity": "string", |
| 226 | + "status": "string", |
| 227 | + "projectcode": "string", |
| 228 | + "resolutions": [ |
| 229 | + { |
| 230 | + "id": 1, |
| 231 | + "defectId": 1, |
| 232 | + "resolutiondate": "YYYY-MM-DD", |
| 233 | + "resolution": "string" |
| 234 | + } |
| 235 | + ] |
| 236 | + } |
| 237 | + ``` |
| 238 | + |
| 239 | +- **Generate report based on project code** |
| 240 | + - **URL:** `/api/defects/report/{projectId}` |
| 241 | + - **Method:** `GET` |
| 242 | + - **Description:** Generate report based on project code. |
| 243 | + - **Response:** |
| 244 | + - **200 OK** |
| 245 | + ```json |
| 246 | + { |
| 247 | + "projectId": 1, |
| 248 | + "defects": [ |
| 249 | + { |
| 250 | + "id": 1, |
| 251 | + "title": "string", |
| 252 | + "defectdetails": "string", |
| 253 | + "stepstoreproduce": "string", |
| 254 | + "priority": "string", |
| 255 | + "detectedon": "YYYY-MM-DD", |
| 256 | + "expectedresolution": "YYYY-MM-DD", |
| 257 | + "reportedbytesterid": "string", |
| 258 | + "assignedtodeveloperid": "string", |
| 259 | + "severity": "string", |
| 260 | + "status": "string", |
| 261 | + "projectcode": "string", |
| 262 | + "resolutions": [ |
| 263 | + { |
| 264 | + "id": 1, |
| 265 | + "defectId": 1, |
| 266 | + "resolutiondate": "YYYY-MM-DD", |
| 267 | + "resolution": "string" |
| 268 | + } |
| 269 | + ] |
| 270 | + } |
| 271 | + ] |
| 272 | + } |
| 273 | + ``` |
| 274 | + |
| 275 | +- **Get all defects** |
| 276 | + - **URL:** `/api/defects/getAll` |
| 277 | + - **Method:** `GET` |
| 278 | + - **Description:** Get all defects. |
| 279 | + - **Response:** |
| 280 | + - **200 OK** |
| 281 | + ```json |
| 282 | + [ |
| 283 | + { |
| 284 | + "id": 1, |
| 285 | + "title": "string", |
| 286 | + "defectdetails": "string", |
| 287 | + "stepstoreproduce": "string", |
| 288 | + "priority": "string", |
| 289 | + "detectedon": "YYYY-MM-DD", |
| 290 | + "expectedresolution": "YYYY-MM-DD", |
| 291 | + "reportedbytesterid": "string", |
| 292 | + "assignedtodeveloperid": "string", |
| 293 | + "severity": "string", |
| 294 | + "status": "string", |
| 295 | + "projectcode": "string", |
| 296 | + "resolutions": [ |
| 297 | + { |
| 298 | + "id": 1, |
| 299 | + "defectId": 1, |
| 300 | + "resolutiondate": "YYYY-MM-DD", |
| 301 | + "resolution": "string" |
| 302 | + } |
| 303 | + ] |
| 304 | + } |
| 305 | + ] |
| 306 | + ``` |
| 307 | + |
| 308 | + |
| 309 | +## Acknowledgments |
| 310 | + |
| 311 | +- Thanks to the Spring Boot community for their comprehensive documentation and support. |
| 312 | +- Inspired by Jira for defect management concepts. |
0 commit comments