Skip to content

Commit

Permalink
refactor: MemberType 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 committed Jun 24, 2024
1 parent 67f8620 commit f307f40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.few.api.repo.dao.member.query.SelectWriterQuery
import com.few.api.repo.dao.member.query.SelectWritersQuery
import com.few.api.repo.dao.member.record.MemberRecord
import com.few.api.repo.dao.member.record.WriterRecord
import com.few.data.common.code.MemberType
import jooq.jooq_dsl.tables.Member
import org.jooq.DSLContext
import org.jooq.impl.DSL
Expand All @@ -26,7 +27,7 @@ class MemberDao(
)
.from(Member.MEMBER)
.where(Member.MEMBER.ID.eq(writerId))
.and(Member.MEMBER.TYPE_CD.eq(1)) // todo fix after considering the type_cd
.and(Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code))
.and(Member.MEMBER.DELETED_AT.isNull)
.fetchOneInto(WriterRecord::class.java)
?: throw IllegalArgumentException("cannot find writer record by writerId: $writerId")
Expand All @@ -40,7 +41,7 @@ class MemberDao(
)
.from(Member.MEMBER)
.where(Member.MEMBER.ID.`in`(query.writerIds))
.and(Member.MEMBER.TYPE_CD.eq(1)) // todo fix after considering the type_cd
.and(Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code))
.and(Member.MEMBER.DELETED_AT.isNull)
.orderBy(Member.MEMBER.ID.asc())
.fetchInto(WriterRecord::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.few.api.repo.dao.member.query.SelectWritersQuery
import com.few.api.repo.dao.member.support.WriterDescription
import com.few.api.repo.dao.member.support.WriterDescriptionJsonMapper
import com.few.api.repo.jooq.JooqTestSpec
import com.few.data.common.code.MemberType
import jooq.jooq_dsl.tables.Member
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertNotNull
Expand Down Expand Up @@ -39,7 +40,7 @@ class MemberDaoTest : JooqTestSpec() {
dslContext.insertInto(Member.MEMBER)
.set(Member.MEMBER.ID, 1)
.set(Member.MEMBER.EMAIL, "[email protected]")
.set(Member.MEMBER.TYPE_CD, 0) // todo fix
.set(Member.MEMBER.TYPE_CD, MemberType.NORMAL.code)
.execute()

val writerDescription = writerDescriptionJsonMapper.toJson(
Expand All @@ -49,7 +50,7 @@ class MemberDaoTest : JooqTestSpec() {
dslContext.insertInto(Member.MEMBER)
.set(Member.MEMBER.ID, 2)
.set(Member.MEMBER.EMAIL, "[email protected]")
.set(Member.MEMBER.TYPE_CD, 1) // todo fix
.set(Member.MEMBER.TYPE_CD, MemberType.WRITER.code)
.set(Member.MEMBER.DESCRIPTION, JSON.valueOf(writerDescription))
.execute()
log.debug("===== finish setUp =====")
Expand Down Expand Up @@ -105,7 +106,7 @@ class MemberDaoTest : JooqTestSpec() {
dslContext.insertInto(Member.MEMBER)
.set(Member.MEMBER.ID, i.toLong())
.set(Member.MEMBER.EMAIL, "writer$i@gmail.com")
.set(Member.MEMBER.TYPE_CD, 1) // todo fix
.set(Member.MEMBER.TYPE_CD, MemberType.WRITER.code)
.set(Member.MEMBER.DESCRIPTION, JSON.valueOf(writerDescription))
.execute()
}
Expand Down

0 comments on commit f307f40

Please sign in to comment.