Skip to content

Commit

Permalink
test: k3s deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondanythings committed Aug 25, 2024
1 parent 265ec11 commit b19e864
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/k3s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Spring Boot Multi-module K3s Deployment
on:
push:
branches:
- chore/k3s
- develop

env:
REGISTRY: "ghcr.io"
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
volumes:
- name: secret-volume
secret:
secretName: app-secret
secretName: app-secret-dev
- name: log-volume
emptyDir: {}
- name: tokens-volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ public List<SpaceWithMemberCount> findAllSpacesByMemberIdAndCategoryAndCursor(Lo
@Override
public Optional<SpaceWithMemberCount> findByIdAndJoinedMemberId(Long spaceId, Long memberId) {

var foundSpace = getSpaceWithMemberCountQuery().where(memberSpaceRelation.memberId.eq(memberId).and(space.id.eq(spaceId))).fetchOne();

var foundSpace = getSpaceWithMemberCountQuery(memberId)
.where(space.id.eq(spaceId))
.fetchOne();

if (foundSpace == null || isSpaceWithMemberCountEmpty(foundSpace)) {
return Optional.empty();
Expand Down Expand Up @@ -133,12 +134,42 @@ private JPAQuery<SpaceWithMemberCount> getSpaceWithMemberCountQuery() {

}

private JPAQuery<SpaceWithMemberCount> getSpaceWithMemberCountQuery(Long memberId) {
log.info("CALL");
QMemberSpaceRelation memberCountRelationTable = new QMemberSpaceRelation("msr");
return queryFactory.select(
new QSpaceWithMemberCount(
space.id,
space.createdAt,
space.updatedAt,
space.category,
space.fieldList,
space.name,
space.introduction,
member,
space.formId,
form.formTag,
memberCountRelationTable.space.id.count().as("memberCount"),
space.bannerUrl
))
.from(space)
.innerJoin(memberSpaceRelation).on(space.id.eq(memberSpaceRelation.space.id)
.and(memberSpaceRelation.memberId.eq(memberId))) // INNER JOIN 사용
.leftJoin(memberCountRelationTable).on(space.id.eq(memberCountRelationTable.space.id))
.leftJoin(member).on(space.leaderId.eq(member.id))
.leftJoin(form).on(space.formId.eq(form.id))
.orderBy(form.id.desc())
.limit(1);
}

private BooleanExpression hasCategory(Optional<SpaceCategory> category) {
return category.map(space.category::eq).orElse(null);

private boolean isSpaceWithMemberCountEmpty(SpaceWithMemberCount spaceWithMemberCount) {
// spaceWithMemberCount의 필드들이 null 또는 기본값인지 확인
return spaceWithMemberCount.getId() == null ||
spaceWithMemberCount.getMemberCount() == null || spaceWithMemberCount.getLeader() == null;
}

private boolean isSpaceWithMemberCountEmpty(SpaceWithMemberCount space) {
return space.getId() == null && space.getName() == null && space.getMemberCount() == 0;
private BooleanExpression hasCategory(Optional<SpaceCategory> category) {
return category.map(space.category::eq).orElse(null);
}
}

0 comments on commit b19e864

Please sign in to comment.