-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
111 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntityMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.grida.persistence.diary | ||
|
||
import org.grida.domain.diary.Diary | ||
import org.grida.domain.user.User | ||
import org.grida.persistence.user.toEntity | ||
|
||
fun Diary.toEntity(user: User): DiaryEntity { | ||
return DiaryEntity( | ||
id = this.id, | ||
targetDate = this.targetDate, | ||
content = this.content, | ||
scope = this.scope, | ||
user = user.toEntity() | ||
) | ||
} | ||
|
||
fun DiaryEntity.toDomain(): Diary { | ||
return Diary( | ||
id = this.id, | ||
timestamp = this.toTimeStamp(), | ||
targetDate = this.targetDate, | ||
content = this.content, | ||
scope = this.scope, | ||
userId = this.user.id | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
...ersistence/diaryimage/DiaryImageMapper.kt → ...ence/diaryimage/DiaryImageEntityMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...tabase-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntityMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.grida.persistence.profileimage | ||
|
||
import org.grida.domain.image.Image | ||
import org.grida.domain.profileimage.Appearance | ||
import org.grida.domain.profileimage.ProfileImage | ||
import org.grida.domain.user.User | ||
import org.grida.persistence.user.toEntity | ||
|
||
fun ProfileImage.toEntity(user: User): ProfileImageEntity { | ||
return ProfileImageEntity( | ||
imageUrl = this.image.url, | ||
status = this.image.status, | ||
gender = this.appearance.gender, | ||
age = this.appearance.age, | ||
hairStyle = this.appearance.hairStyle, | ||
glasses = this.appearance.glasses, | ||
bodyShape = this.appearance.bodyShape, | ||
user = user.toEntity() | ||
) | ||
} | ||
|
||
fun ProfileImageEntity.toDomain(): ProfileImage { | ||
return ProfileImage( | ||
id = this.id, | ||
userId = this.user.id, | ||
image = Image( | ||
url = this.imageUrl, | ||
status = this.status, | ||
timestamp = this.toTimeStamp() | ||
), | ||
appearance = Appearance( | ||
gender = this.gender, | ||
age = this.age, | ||
hairStyle = this.hairStyle, | ||
glasses = this.glasses, | ||
bodyShape = this.bodyShape | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
grida-database/database-rds/src/main/kotlin/org/grida/persistence/user/UserEntityMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.grida.persistence.user | ||
|
||
import org.grida.domain.user.User | ||
|
||
fun User.toEntity(): UserEntity { | ||
return UserEntity( | ||
id = this.id, | ||
username = this.username, | ||
password = this.password, | ||
role = this.role, | ||
nickname = this.nickname | ||
) | ||
} | ||
|
||
fun UserEntity.toDomain(): User { | ||
return User( | ||
id = this.id, | ||
username = this.username, | ||
password = this.password, | ||
role = this.role, | ||
nickname = this.nickname, | ||
timestamp = this.toTimeStamp() | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters