Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
{
"name": "Java",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/java:0-17",
"image": "mcr.microsoft.com/devcontainers/java:21",

"features": {
"ghcr.io/devcontainers/features/java:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers-contrib/features/quarkus-sdkman:2": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers-contrib/features/maven-sdkman:2": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand All @@ -21,26 +23,37 @@
"customizations": {
"vscode": {
"extensions": [
"Equinusocio.vsc-material-theme-icons",
"ybaumes.highlight-trailing-white-spaces",
"amodio.amethyst-theme",
"vscjava.vscode-java-pack",
"cweijan.vscode-mysql-client2",
"redhat.vscode-quarkus",
"GitHub.copilot",
"Equinusocio.vsc-material-theme-icons",
"redhat.vscode-microprofile-pack",
"eamodio.gitlens",
"rangav.vscode-thunder-client"
"rangav.vscode-thunder-client",
"vscjava.vscode-lombok",
"GitHub.copilot",
"GitHub.copilot-chat",
"GitHub.vscode-github-actions",
"GitHub.vscode-pull-request-github",
"cweijan.vscode-mysql-client2",
"cracrayol.java-pmd",
"SonarSource.sonarlint-vscode",
"streetsidesoftware.code-spell-checker-portuguese-brazilian"
],
"settings": {
"workbench.colorTheme": "GitHub Light Default",
"workbench.colorTheme": "Default Light Modern",
"workbench.iconTheme": "eq-material-theme-icons-light",
"editor.rulers": [80,120],
"workbench.colorCustomizations": {
"editorRuler.foreground": "#F3F7FF"
}
},
"cSpell.enabled": true,
"cSpell.language": "pt_BR, en, pt"
}
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
}
74 changes: 41 additions & 33 deletions docs/usecases/CreateChannel/createChannel.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ nav_order: 4

## Create Channel

* A client sends the name of the channel to the service.
* The service verifies if the name is note empty, persist the
data and returns the a JSON object representing a channel.
* A client sends two objects to the server, the channel with a name and a user
with a name and hash. Besides that, the client also sends an authorization
token (JWT) in the header of the request.
* The service verifies if the token is valid and the fields are not empty,
persist the data and returns the a JSON object representing a channel.

## GraphQL

Expand All @@ -18,41 +20,47 @@ through a mutation in `/graphql` endpoint.

* Example of request:

```shell
curl -X POST \
'http://localhost:8080/graphql' \
--header 'Accept: */*' \
--data-raw '{"query":"mutation addChannel {\n createChannel(channel: {\n name: \"My channel\"\n }\n )\n {\n name\n hash\n messages {\n hash\n text\n }\n }\n}","variables":"{}"}'
```
```shell
curl -X POST \
'http://localhost:8082/graphql' \
--header 'Accept: */*' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJvcmlvbi11c2VycyIsInVwbiI6InJvZHJpZ29AdGVzdGUuY29tIiwiZ3JvdXBzIjpbInVzZXIiXSwiY19oYXNoIjoiMTZhNjc4YjctNWE0NC00MWExLWIzNmEtNGE3NmE2NDU1MjQ0IiwiZW1haWwiOiJyb2RyaWdvQHRlc3RlLmNvbSIsImlhdCI6MTcxNTAwMTgxMiwiZXhwIjoxNzE3NTkzODEyLCJqdGkiOiI1YzZiNDg2YS0zNWE0LTQzYmYtYmVmMS04YTQ5MzI5ZjEyOWEifQ.cRDhwRZ0Yuel5revQy1D1FUhfPYZtxVFLyaTJrAdTY_7djnplIBrm_VwftoXUCngjZd2YoOId3GX7c2GtAYSt24aHNWMhg3OKwIWQCHr6izQ7IAvsVTqJeJzHlQtx6s4mA6kWV76Ea7oCMDydtz397WJpkvALSPR0QM-XTn5AQ6-K0axOrJBCnvnZR_wL4TJgUBg2qOmoHUlhdi5HNbADN1UL-t6sRPYtqtos0dXRdH7LQjKrlzs30pXaJMIy3-Xm_bUgaoN4yryGi55mubyYvtuTIa1Do9ICMRsLLpRk8NjFJ-gjAssriYIs0IvrQXnlCbYXwqY_tqDGey_VcRDEA' \
--header 'Content-Type: application/json' \
--data-raw '{"query":" mutation addChannel {\n createChannel(channel: {\n name: \"My teste channel\"\n },\n user:{\n name: \"Rodrigo\"\n hash: \"16a678b7-5a44-41a1-b36a-4a76a6455244\"\n })\n {\n name\n hash\n messages {\n hash\n text\n }\n }\n }\n","variables":"{}"}'
```

* Example of mutation:

```json
mutation addChannel {
createChannel(channel: {
name: "My channel"
})
{
name
hash
messages {
hash
text
}
}
```json
mutation addChannel {
createChannel(channel: {
name: "My teste channel"
},
user:{
name: "Rodrigo"
hash: "16a678b7-5a44-41a1-b36a-4a76a6455244"
})
{
name
hash
messages {
hash
text
}
```
}
}
```

* Example of answer:

```json
{
"data": {
"createChannel": {
"name": "My channel",
"hash": "6077a738-77ce-404d-8568-ef08374fd0bd",
"messages": []
}
}
```json
{
"data": {
"createChannel": {
"name": "My teste channel",
"hash": "16ea8abc-dfc9-4984-9203-25620268e79a",
"messages": []
}
```
}
}
```
6 changes: 3 additions & 3 deletions docs/usecases/CreateMessage/createMessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ parent: Features
nav_order: 3
---

## Create Message
# Create Message

* A client sends a text, user hash and the channel hash to the service. Note: if
the user hash or channel hash does not exist, the service will create in the
data base.
* The service verifies if user hash and channel hash are note empty, persist the
data and returns the a JSON object representing a message.

## HTTP(S) endpoints
## HTTPS Endpoints

* /talk/message/create
* HTTP method: POST
* Method: POST
* Consumes: application/x-www-form-urlencoded
* Produces: application/json
* Examples:
Expand Down
141 changes: 110 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>dev.orion</groupId>
<artifactId>talk</artifactId>
<version>1.0.0</version>
<properties>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
<compiler-plugin.version>3.12.1</compiler-plugin.version>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.5.0</quarkus.platform.version>
<quarkus.platform.version>3.10.0</quarkus.platform.version>
<surefire-plugin.version>3.2.5</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -94,6 +96,11 @@
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-security</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
Expand Down Expand Up @@ -127,28 +134,9 @@
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>checkstyle</id>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
<maxAllowedViolations>10</maxAllowedViolations>
<suppressionsLocation>config/checkstyle-suppressions.xml</suppressionsLocation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<phase>test</phase>
Expand All @@ -161,28 +149,119 @@
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<quarkus.jacoco.data-file>${maven.multiModuleProjectDirectory}/target/jacoco-quarkus.exec</quarkus.jacoco.data-file>
<quarkus.jacoco.reuse-data-file>true</quarkus.jacoco.reuse-data-file>
<quarkus.jacoco.report-location>${maven.multiModuleProjectDirectory}/target/coverage</quarkus.jacoco.report-location>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.1.2</version>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<phase>test</phase>
<phase>verify</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
<skipTests>false</skipTests>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<exclClassLoaders>*QuarkusClassLoader</exclClassLoaders>
<destFile>${project.build.directory}/jacoco-quarkus.exec</destFile>
<append>true</append>
</configuration>
</execution>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-quarkus.exec</dataFile>
<outputDirectory>${project.build.directory}/jacoco-report</outputDirectory>
</configuration>
</execution>
<execution>
<id>verify</id>
<phase>check</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-quarkus.exec</dataFile>
<outputDirectory>${project.build.directory}/jacoco-report</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.8</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
<maxAllowedViolations>10</maxAllowedViolations>
<suppressionsLocation>static/checkstyle.xml</suppressionsLocation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.22.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnViolation>true</failOnViolation>
<maxAllowedViolations>10</maxAllowedViolations>
<rulesets>
<ruleset>/static/pmd.xml</ruleset>
</rulesets>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @License
* Copyright 2023 Orion Services @ https://github.com/orion-services
* Copyright 2024 Orion Services @ https://github.com/orion-services
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading