Repository navigation
Add tire test reporting platform scaffold #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aykutmayali
wants to merge
1
commit into
master
Choose a base branch
from
codex/generate-tire-test-reporting-platform-project
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: 17 | ||
|
|
||
| - name: Build backend | ||
| run: mvn -f backend/pom.xml verify | ||
|
|
||
| - name: Set up Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install frontend deps | ||
| run: npm ci | ||
| working-directory: frontend | ||
|
|
||
| - name: Build frontend | ||
| run: npm run build | ||
| working-directory: frontend | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,7 @@ | |
| *.log | ||
| *.synctex.gz | ||
| *.toc | ||
| _minted-* | ||
| _minted-* | ||
| backend/target/ | ||
| frontend/node_modules/ | ||
| frontend/dist/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>com.example</groupId> | ||
| <artifactId>tire-test-reporting-platform</artifactId> | ||
| <version>1.0.0-SNAPSHOT</version> | ||
| <properties> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| <maven.compiler.release>17</maven.compiler.release> | ||
| <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id> | ||
| <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> | ||
| <quarkus.platform.version>3.8.2</quarkus.platform.version> | ||
| <surefire-plugin.version>3.2.5</surefire-plugin.version> | ||
| </properties> | ||
|
|
||
| <dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>${quarkus.platform.group-id}</groupId> | ||
| <artifactId>${quarkus.platform.artifact-id}</artifactId> | ||
| <version>${quarkus.platform.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-resteasy-reactive</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-resteasy-reactive-jackson</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-hibernate-orm-panache</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-hibernate-validator</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-jdbc-postgresql</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-flyway</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-junit5</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.rest-assured</groupId> | ||
| <artifactId>rest-assured</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.mockito</groupId> | ||
| <artifactId>mockito-junit-jupiter</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-maven-plugin</artifactId> | ||
| <version>${quarkus.platform.version}</version> | ||
| <extensions>true</extensions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <version>${surefire-plugin.version}</version> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
39 changes: 39 additions & 0 deletions
39
backend/src/main/java/com/example/tire/api/LabResource.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package com.example.tire.api; | ||
|
|
||
| import com.example.tire.domain.Lab; | ||
| import com.example.tire.dto.LabDto; | ||
| import com.example.tire.mapper.LabMapper; | ||
| import com.example.tire.service.LabService; | ||
| import jakarta.inject.Inject; | ||
| import jakarta.validation.Valid; | ||
| import jakarta.ws.rs.Consumes; | ||
| import jakarta.ws.rs.GET; | ||
| import jakarta.ws.rs.POST; | ||
| import jakarta.ws.rs.Path; | ||
| import jakarta.ws.rs.Produces; | ||
| import jakarta.ws.rs.core.MediaType; | ||
| import jakarta.ws.rs.core.Response; | ||
|
|
||
| import java.net.URI; | ||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| @Path("/api/labs") | ||
| @Produces(MediaType.APPLICATION_JSON) | ||
| @Consumes(MediaType.APPLICATION_JSON) | ||
| public class LabResource { | ||
|
|
||
| @Inject | ||
| LabService labService; | ||
|
|
||
| @GET | ||
| public List<LabDto> listLabs() { | ||
| return labService.listAll().stream().map(LabMapper::toDto).collect(Collectors.toList()); | ||
| } | ||
|
|
||
| @POST | ||
| public Response createLab(@Valid Lab lab) { | ||
| Lab created = labService.create(lab); | ||
| return Response.created(URI.create("/api/labs/" + created.getId())).entity(LabMapper.toDto(created)).build(); | ||
| } | ||
| } |
57 changes: 57 additions & 0 deletions
57
backend/src/main/java/com/example/tire/api/TestRunResource.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| package com.example.tire.api; | ||
|
|
||
| import com.example.tire.dto.CreateTestRunRequest; | ||
| import com.example.tire.dto.GripAverageDto; | ||
| import com.example.tire.dto.TestRunDto; | ||
| import com.example.tire.mapper.TestRunMapper; | ||
| import com.example.tire.service.TestRunService; | ||
| import jakarta.inject.Inject; | ||
| import jakarta.validation.Valid; | ||
| import jakarta.ws.rs.*; | ||
| import jakarta.ws.rs.core.MediaType; | ||
| import jakarta.ws.rs.core.Response; | ||
|
|
||
| import java.net.URI; | ||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| @Path("/api/tests") | ||
| @Produces(MediaType.APPLICATION_JSON) | ||
| @Consumes(MediaType.APPLICATION_JSON) | ||
| public class TestRunResource { | ||
|
|
||
| @Inject | ||
| TestRunService testRunService; | ||
|
|
||
| @GET | ||
| public List<TestRunDto> list(@QueryParam("labId") Long labId, | ||
| @QueryParam("from") LocalDateTime from, | ||
| @QueryParam("to") LocalDateTime to) { | ||
| return testRunService.findByFilters(labId, from, to) | ||
| .stream() | ||
| .map(TestRunMapper::toDto) | ||
| .collect(Collectors.toList()); | ||
| } | ||
|
|
||
| @GET | ||
| @Path("/{id}") | ||
| public Response getById(@PathParam("id") Long id) { | ||
| return testRunService.findById(id) | ||
| .map(testRun -> Response.ok(TestRunMapper.toDto(testRun)).build()) | ||
| .orElse(Response.status(Response.Status.NOT_FOUND).build()); | ||
| } | ||
|
|
||
| @POST | ||
| public Response create(@Valid CreateTestRunRequest request) { | ||
| var created = testRunService.create(request); | ||
| return Response.created(URI.create("/api/tests/" + created.getId())) | ||
| .entity(TestRunMapper.toDto(created)).build(); | ||
| } | ||
|
|
||
| @GET | ||
| @Path("/stats/average-grip") | ||
| public List<GripAverageDto> averageGrip() { | ||
| return testRunService.averageWetGripPerLab(); | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
backend/src/main/java/com/example/tire/api/TireResource.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package com.example.tire.api; | ||
|
|
||
| import com.example.tire.domain.Tire; | ||
| import com.example.tire.dto.TireDto; | ||
| import com.example.tire.mapper.TireMapper; | ||
| import com.example.tire.service.TireService; | ||
| import jakarta.inject.Inject; | ||
| import jakarta.validation.Valid; | ||
| import jakarta.ws.rs.Consumes; | ||
| import jakarta.ws.rs.GET; | ||
| import jakarta.ws.rs.POST; | ||
| import jakarta.ws.rs.Path; | ||
| import jakarta.ws.rs.Produces; | ||
| import jakarta.ws.rs.core.MediaType; | ||
| import jakarta.ws.rs.core.Response; | ||
|
|
||
| import java.net.URI; | ||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| @Path("/api/tires") | ||
| @Produces(MediaType.APPLICATION_JSON) | ||
| @Consumes(MediaType.APPLICATION_JSON) | ||
| public class TireResource { | ||
|
|
||
| @Inject | ||
| TireService tireService; | ||
|
|
||
| @GET | ||
| public List<TireDto> listTires() { | ||
| return tireService.listAll().stream().map(TireMapper::toDto).collect(Collectors.toList()); | ||
| } | ||
|
|
||
| @POST | ||
| public Response createTire(@Valid Tire tire) { | ||
| Tire created = tireService.create(tire); | ||
| return Response.created(URI.create("/api/tires/" + created.getId())).entity(TireMapper.toDto(created)).build(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| package com.example.tire.domain; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.GenerationType; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.Table; | ||
| import jakarta.validation.constraints.NotBlank; | ||
|
|
||
| @Entity | ||
| @Table(name = "labs") | ||
| public class Lab { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @NotBlank | ||
| @Column(nullable = false, unique = true, length = 64) | ||
| private String code; | ||
|
|
||
| @NotBlank | ||
| @Column(nullable = false, length = 128) | ||
| private String name; | ||
|
|
||
| @NotBlank | ||
| @Column(nullable = false, length = 32) | ||
| private String region; | ||
|
|
||
| public Long getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Long id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public String getCode() { | ||
| return code; | ||
| } | ||
|
|
||
| public void setCode(String code) { | ||
| this.code = code; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public void setName(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public String getRegion() { | ||
| return region; | ||
| } | ||
|
|
||
| public void setRegion(String region) { | ||
| this.region = region; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI workflow installs frontend dependencies using
npm ci, but the repository does not includefrontend/package-lock.json.npm ciexits withERR! ci can only install with an existing package-lock.json or npm-shrinkwrap.json, so the frontend build job will fail on every run.Useful? React with 👍 / 👎.