Skip to content
Merged
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
21 changes: 11 additions & 10 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,32 @@ on:
tags:
- '*'

permissions:
contents: read
packages: write

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@v4

- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'oracle'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew clean build publishToMavenLocal -x test

- name: Trigger JitPack build
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
REPO_FULL_NAME=${{ github.repository }}
curl -s "https://jitpack.io/api/builds/com.github.${REPO_FULL_NAME//\//.}/${TAG_NAME}"
- name: Publish to GitHub Packages
run: ./gradlew clean publish -x test
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 11 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,34 @@ on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
build-and-publish:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@v4

- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'oracle'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39 changes: 33 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,44 @@ plugins {
}

group = "team.themoment.datagsm.sdk"
version = "1.7.0"
version = "2.0.0"

java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
sourceCompatibility = JavaVersion.VERSION_13
targetCompatibility = JavaVersion.VERSION_13
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}

val gprUser: String = (findProperty("gpr.user") as String?) ?: System.getenv("GITHUB_ACTOR") ?: ""
val gprToken: String = (findProperty("gpr.token") as String?) ?: System.getenv("GITHUB_TOKEN") ?: ""

repositories {
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/themoment-team/datagsm-server")
credentials {
username = gprUser
password = gprToken
}
}
}

dependencies {
// Shared types from datagsm-server (api: 반환 타입이 공개 API에 노출되므로 소비자 컴파일 클래스패스에 포함)
api("team.themoment:datagsm-shared-jvm:20260618-38")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")

// HTTP Client
implementation("com.squareup.okhttp3:okhttp:4.12.0")

// JSON Processing
implementation("com.google.code.gson:gson:2.11.0")
// JSON Processing (Jackson + Kotlin support)
implementation("com.fasterxml.jackson.core:jackson-databind:2.18.3")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")

// Testing
testImplementation(platform("org.junit:junit-bom:5.11.4"))
Expand All @@ -38,6 +54,17 @@ tasks.test {
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/themoment-team/datagsm-openapi-sdk-java")
credentials {
username = gprUser
password = gprToken
}
}
}

publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
Expand Down Expand Up @@ -78,7 +105,7 @@ publishing {

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(13)
options.release.set(17)
}

tasks.withType<Javadoc> {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ org.gradle.parallel=true
org.gradle.caching=true
org.gradle.daemon=true
org.gradle.configuration-cache=true

7 changes: 0 additions & 7 deletions jitpack.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
package team.themoment.datagsm.sdk.openapi.client;

import team.themoment.datagsm.sdk.openapi.model.*;
import team.themoment.datagsm.sdk.openapi.model.SortDirection;
import team.themoment.datagsm.shared.domain.club.dto.response.ClubListResDto;
import team.themoment.datagsm.shared.domain.club.dto.response.ClubResDto;
import team.themoment.datagsm.shared.domain.club.entity.constant.ClubSortBy;
import team.themoment.datagsm.shared.domain.club.entity.constant.ClubStatus;
import team.themoment.datagsm.shared.domain.club.entity.constant.ClubType;

/**
* 동아리 데이터 API 인터페이스
*/
public interface ClubApi {
/**
* 동아리 목록 조회
*
* @param request 조회 조건
* @return 동아리 응답
*/
ClubResponse getClubs(ClubRequest request);

/**
* 특정 동아리 조회
*
* @param clubId 동아리 ID
* @return 동아리 상세 정보
*/
ClubDetail getClub(Long clubId);

/**
* 동아리 요청 파라미터 빌더
*/
ClubListResDto getClubs(ClubRequest request);

ClubResDto getClub(Long clubId);

class ClubRequest {
private Long clubId;
private String clubName;
Expand Down Expand Up @@ -94,44 +81,15 @@ public ClubRequest sortDirection(SortDirection sortDirection) {
return this;
}

public Long getClubId() {
return clubId;
}

public String getClubName() {
return clubName;
}

public ClubType getClubType() {
return clubType;
}

public ClubStatus getStatus() {
return status;
}

public Integer getFoundedYear() {
return foundedYear;
}

public Integer getPage() {
return page;
}

public Integer getSize() {
return size;
}

public Boolean getIncludeLeaderInParticipants() {
return includeLeaderInParticipants;
}

public ClubSortBy getSortBy() {
return sortBy;
}

public SortDirection getSortDirection() {
return sortDirection;
}
public Long getClubId() { return clubId; }
public String getClubName() { return clubName; }
public ClubType getClubType() { return clubType; }
public ClubStatus getStatus() { return status; }
public Integer getFoundedYear() { return foundedYear; }
public Integer getPage() { return page; }
public Integer getSize() { return size; }
public Boolean getIncludeLeaderInParticipants() { return includeLeaderInParticipants; }
public ClubSortBy getSortBy() { return sortBy; }
public SortDirection getSortDirection() { return sortDirection; }
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package team.themoment.datagsm.sdk.openapi.client;

import com.google.gson.reflect.TypeToken;
import com.fasterxml.jackson.core.type.TypeReference;
import team.themoment.datagsm.sdk.openapi.http.HttpClient;
import team.themoment.datagsm.sdk.openapi.http.JsonUtil;
import team.themoment.datagsm.sdk.openapi.model.*;
import team.themoment.datagsm.sdk.openapi.model.CommonApiResponse;
import team.themoment.datagsm.shared.domain.club.dto.response.ClubListResDto;
import team.themoment.datagsm.shared.domain.club.dto.response.ClubResDto;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

/**
* 동아리 데이터 API 구현
*/
public class ClubApiImpl implements ClubApi {
private final HttpClient httpClient;
private final String apiKey;
Expand All @@ -24,25 +22,26 @@ public ClubApiImpl(HttpClient httpClient, String apiKey, String baseUrl) {
}

@Override
public ClubResponse getClubs(ClubRequest request) {
public ClubListResDto getClubs(ClubRequest request) {
Map<String, String> headers = createHeaders();
Map<String, String> queryParams = buildClubQueryParams(request);

String responseBody = httpClient.get(baseUrl + "/v1/clubs", headers, queryParams);
Type type = new TypeToken<CommonApiResponse<ClubResponse>>(){}.getType();
CommonApiResponse<ClubResponse> apiResponse = JsonUtil.fromJson(responseBody, type);
CommonApiResponse<ClubListResDto> apiResponse = JsonUtil.fromJson(
responseBody, new TypeReference<CommonApiResponse<ClubListResDto>>() {}
);
return apiResponse.getData();
}

@Override
public ClubDetail getClub(Long clubId) {
public ClubResDto getClub(Long clubId) {
ClubRequest request = new ClubRequest().clubId(clubId);
ClubResponse response = getClubs(request);
ClubListResDto response = getClubs(request);

if (response.getClubs() != null && !response.getClubs().isEmpty()) {
return response.getClubs().get(0);
ClubResDto[] clubs = response.getClubs();
if (clubs != null && clubs.length > 0) {
return clubs[0];
}

return null;
}

Expand Down
Loading
Loading