forked from GDSC-PKNU-Official/To-Do-Android
-
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.
Issue GDSC-PKNU-Official#51 feat: Add mapping todo entity
- Loading branch information
Showing
2 changed files
with
32 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.gdsc.todo.data.entity | ||
|
||
import android.os.Build | ||
import androidx.annotation.RequiresApi | ||
import java.time.LocalDateTime | ||
import java.time.ZoneOffset | ||
|
||
@RequiresApi(Build.VERSION_CODES.O) | ||
data class ToDo ( | ||
val id: Long = 0, | ||
val title: String, | ||
val contents: String, | ||
val date: LocalDateTime = LocalDateTime.now() | ||
) { | ||
fun to() = ToDoEntity( | ||
id = id, | ||
title = title, | ||
contents = contents, | ||
date = date.toEpochSecond(ZoneOffset.UTC) | ||
) | ||
} |
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