Skip to content
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

Practice/kehao #27

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.jpg filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.svg filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.ico filter=lfs diff=lfs merge=lfs -text
*.asta filter=lfs diff=lfs merge=lfs -text
41 changes: 41 additions & 0 deletions .github/workflows/github-actions-kehao.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Kehao's Walking Skeleton Implementation

on:
push:
branches:
- 'practice/kehao'

permissions:
contents: read

jobs:
build-kehao:
environment: kehao
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./yugioh-kehao
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
build-root-directory: ./yugioh-kehao

- name: Execute Gradle test task
run: ./gradlew test

- name: Execute Gradle jib task
run: ./gradlew jib
env:
CR_URI: ${{ secrets.CR_URI }}
CR_USERNAME: ${{ secrets.CR_USERNAME }}
CR_PASSWORD: ${{ secrets.CR_PASSWORD }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@
2. 忘記了,大家下次記得提醒偶
3. [遊戲王第三次開會](https://youtu.be/HZFNxIcTyQM)
4. [遊戲王第四次開會](https://youtu.be/yCsG4E655xU)
5. [遊戲王第五次開會](https://youtu.be/F6Cfz6IpBgo)
6. [遊戲王第六次開會](https://youtu.be/QzR8h71O60U)

181 changes: 181 additions & 0 deletions yugioh-20221012/.http/test.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
### Vincent Login
POST http://localhost:8080/java/api/v1.0/auth:login
Content-Type: application/json

{
"username": "vincent",
"password": "123456"
}

> {%
client.global.set("bearerTokenV", response.body.token.toString());
%}


### qrtt1 Login
POST http://localhost:8080/java/api/v1.0/auth:login
Content-Type: application/json

{
"username": "qrtt1",
"password": "123456"
}

> {%
client.global.set("bearerTokenQ", response.body.token.toString());
%}


### Musk Login
#POST http://localhost:8080/java/api/v1.0/auth:login
#Content-Type: application/json
#
#{
# "username": "musk",
# "password": "123456"
#}
#
#> {%
# client.global.set("bearerTokenM", response.body.token.toString());
#%}


### Vincent Join Games
POST http://localhost:8080/java/api/v1.0/duelField:join
Authorization: Bearer {{bearerTokenV}}

> {%
client.global.set("uuid", response.body.duelFieldUuid.toString());
%}


### qrtt1 Join Games
POST http://localhost:8080/java/api/v1.0/duelField:join
Authorization: Bearer {{bearerTokenQ}}


### Java status endpoint
GET http://localhost:8080/java/api/v1.0/status

> {%
client.test("Request executed successfully", function () {
client.log(client.global.get("bearerTokenV").toString());
client.log(client.global.get("bearerTokenQ").toString());
// client.log(client.global.get("bearerTokenM").toString());
client.log(client.global.get("uuid").toString());
client.assert(response.status === 200, "Response status is not 200");
});
%}


### Vincent Get DuelField By Uuid (Duelist)
GET http://localhost:8080/java/api/v1.0/duelField/{{uuid}}
Authorization: Bearer {{bearerTokenV}}


### qrtt1 Get DuelField By Uuid (Duelist)
GET http://localhost:8080/java/api/v1.0/duelField/{{uuid}}
Authorization: Bearer {{bearerTokenQ}}


#### Musk Get DuelField By Uuid
#GET http://localhost:8080/java/api/v1.0/duelField/{{uuid}}
#Authorization: Bearer {{bearerTokenM}}


### Get DuelField By Uuid SSE
GET http://localhost:8080/java/api/v1.0/duelField/{{uuid}}:sse
Authorization: Bearer {{bearerTokenV}}
Content-Type: text/event-stream


### Vincent Draw Card
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/LEFT:drawCard
Authorization: Bearer {{bearerTokenV}}


### Vincent Summon Monster
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/LEFT:summonMonster
Authorization: Bearer {{bearerTokenV}}
Content-Type: application/json

{
"uuid": "257b6fb6-875a-449a-a8ae-e12b9a4b175a"
}


### Vincent Apply Spell
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/LEFT:applySpell
Authorization: Bearer {{bearerTokenV}}
Content-Type: application/json

{
"uuid": "e683066b-7344-44ae-9ae7-01cffaaa7dd1"
}


### Vincent Cover Trap
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/LEFT:coverTrap?skip=true
Authorization: Bearer {{bearerTokenV}}
Content-Type: application/json

{
"uuid": "152927b0-6a4d-4baa-828d-5d65b2ef58a8",
"state": "BACK"
}


### Vincent Start Battle
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/LEFT:startBattle
Authorization: Bearer {{bearerTokenV}}
Content-Type: application/json

{
"uuid": "06474d38-00e3-4e6c-a9bc-4c5e09c10630"
}


### qrtt1 Draw Card
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/RIGHT:drawCard
Authorization: Bearer {{bearerTokenQ}}


### qrtt1 Summon Monster
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/RIGHT:summonMonster
Authorization: Bearer {{bearerTokenQ}}
Content-Type: application/json

{
"uuid": "0cb87c23-6343-49c7-9187-56c43bb07f3d"
}


### qrtt1 Apply Spell
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/RIGHT:applySpell?skip=true
Authorization: Bearer {{bearerTokenQ}}
Content-Type: application/json

{
"uuid": "d968a1bd-bc5b-4797-be23-1ea4fd5cb2f5"
}


### qrtt1 Cover Trap
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/RIGHT:coverTrap
Authorization: Bearer {{bearerTokenQ}}
Content-Type: application/json

{
"uuid": "c33946ce-511a-48a2-99e2-26cee99a787e",
"state": "BACK"
}


### qrtt1 Start Battle
POST http://localhost:8080/java/api/v1.0/duelField/{{uuid}}/RIGHT:startBattle?skip=true
Authorization: Bearer {{bearerTokenQ}}
Content-Type: application/json

{
"uuid": "9c67000f-feac-4024-ad7a-632ac89d9fa0"
}
7 changes: 6 additions & 1 deletion yugioh-20221012/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ repositories {
}

dependencies {
implementation("com.github.PureFuncInc:emoji-jvm-string:1.5.1")
implementation("com.github.PureFuncInc:emoji-jvm-string:1.6.1")

implementation("io.jsonwebtoken:jjwt-impl:0.11.2")
implementation("io.jsonwebtoken:jjwt-jackson:0.11.2")

implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-data-redis")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
Expand All @@ -39,6 +43,7 @@ dependencies {
runtimeOnly("org.postgresql:postgresql")
annotationProcessor("org.projectlombok:lombok")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
}

tasks.withType<KotlinCompile> {
Expand Down
11 changes: 0 additions & 11 deletions yugioh-20221012/http/Test.http

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
package tw.gaas.yugioh.domain.dto;
package tw.gaas.yugioh.data.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import tw.gaas.yugioh.domain.card.enu.Attribute;
import tw.gaas.yugioh.domain.card.enu.MonsterType;
import tw.gaas.yugioh.domain.card.enu.SpellType;
import tw.gaas.yugioh.domain.card.enu.TrapType;
import tw.gaas.yugioh.domain.card.enu.Type;
import tw.gaas.yugioh.data.enu.Attribute;
import tw.gaas.yugioh.data.enu.MonsterType;
import tw.gaas.yugioh.data.enu.SpellType;
import tw.gaas.yugioh.data.enu.State;
import tw.gaas.yugioh.data.enu.TrapType;
import tw.gaas.yugioh.data.enu.Type;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CardDto {

private String uuid;

private State state;

private String name;

private Type type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package tw.gaas.yugioh.domain.dto;
package tw.gaas.yugioh.data.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import tw.gaas.yugioh.data.enu.State;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SpellAndTrapCardsDto {
public class CardReqDto {

private String uuid;

private List<CardDto> elements;
private State state = State.FRONT;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tw.gaas.yugioh.domain.dto;
package tw.gaas.yugioh.data.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -11,7 +11,7 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DeckDto {
public class CardsDto {

private List<CardDto> elements;
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package tw.gaas.yugioh.domain.dto;
package tw.gaas.yugioh.data.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import tw.gaas.yugioh.domain.card.enu.Phase;
import tw.gaas.yugioh.data.enu.Phase;

import java.util.List;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DuelFieldDto {

private List<String> boardMessages;

private String uuid;

private ZoneDto left;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tw.gaas.yugioh.domain.dto;
package tw.gaas.yugioh.data.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -15,5 +15,5 @@ public class DuelistDto {

private Integer lp;

private Integer handCardsAmount;
private CardsDto handCards;
}
Loading