Skip to content

Commit

Permalink
fix: pose type 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Aug 3, 2024
1 parent 049c7e4 commit 1240692
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sql/DDL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ CREATE TABLE `pose_snapshot`
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'pose snapshot id',
`uid` bigint NOT NULL COMMENT 'uid',
`score` DECIMAL(20, 16) NOT NULL COMMENT '포즈 신뢰도 종합',
`type` VARCHAR(32) NOT NULL COMMENT '포즈 타입',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일',
`modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='포즈 스냅샷';
CREATE INDEX idx__uid ON pose_snapshot (uid);
CREATE INDEX idx__created_at ON pose_snapshot (created_at);

-- 포즈 key point 스냅샷
CREATE TABLE `pose_key_point_snapshot`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class PoseSnapshotFacade(
val createdPoseSnapshot = poseSnapshotService.saveSync(
PoseSnapshot(
uid = user.uid,
score = request.snapshot.score
score = request.snapshot.score,
type = request.type,
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ data class PoseSnapshot(

@Column(name = "score")
val score: BigDecimal,

@Column(name = "type")
val type: PoseType,
) : BaseEntity()
18 changes: 18 additions & 0 deletions src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.hero.alignlab.domain.pose.domain

import com.fasterxml.jackson.annotation.JsonEnumDefaultValue

enum class PoseType(val nameKor: String) {
/** 좋은 포즈 */
GOOD("좋은 상태"),

/** 나쁜 포즈 */
TURTLE_NECK("거북목"),
SHOULDER_TWIST("어깨 틀어짐"),
CHIN_UTP("턱 괴기"),

/** 예외처리 */
@JsonEnumDefaultValue
UNKNOWN("예외 타입"),
;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.hero.alignlab.domain.pose.model.request

import com.hero.alignlab.domain.pose.domain.PoseType
import com.hero.alignlab.domain.pose.model.PoseSnapshotModel

data class PoseSnapshotRequest(
/** 스냅샷 원천 데이터 */
val snapshot: PoseSnapshotModel,
/** 포즈 타입 */
val type: PoseType,
)
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.hero.alignlab.domain.pose.model.response

import com.hero.alignlab.domain.pose.domain.PoseSnapshot
import com.hero.alignlab.domain.pose.domain.PoseType
import java.time.LocalDateTime

data class PoseSnapshotResponse(
val id: Long,
val uid: Long,
val type: PoseType,
val createdAt: LocalDateTime,
) {
companion object {
fun from(createdPoseSnapshot: PoseSnapshot): PoseSnapshotResponse {
return PoseSnapshotResponse(
id = createdPoseSnapshot.id,
uid = createdPoseSnapshot.uid,
type = createdPoseSnapshot.type,
createdAt = createdPoseSnapshot.createdAt
)
}
Expand Down

0 comments on commit 1240692

Please sign in to comment.