-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
12 changed files
with
1,414 additions
and
119 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package io.github.bayang.jelu.utils | ||
|
||
import java.time.Instant | ||
import java.time.LocalDate | ||
import java.time.OffsetDateTime | ||
import java.time.ZoneId | ||
|
||
fun nowInstant(): Instant = OffsetDateTime.now(ZoneId.systemDefault()).toInstant() | ||
|
||
fun toInstant(date: LocalDate): Instant = date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant() |
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,58 @@ | ||
package io.github.bayang.jelu | ||
|
||
import io.github.bayang.jelu.dao.ReadingEventType | ||
import io.github.bayang.jelu.dto.AuthorDto | ||
import io.github.bayang.jelu.dto.BookCreateDto | ||
import io.github.bayang.jelu.dto.CreateUserBookDto | ||
import io.github.bayang.jelu.dto.TagDto | ||
import java.time.Instant | ||
|
||
fun createUserBookDto(bookDto: BookCreateDto, lastReadingEvent: ReadingEventType? = null, lastreadingEventDate: Instant? = null): CreateUserBookDto { | ||
return CreateUserBookDto( | ||
personalNotes = "test personal notes\nwith a newline", | ||
lastReadingEvent = lastReadingEvent, | ||
lastReadingEventDate = lastreadingEventDate, | ||
owned = true, | ||
toRead = false, | ||
percentRead = null, | ||
book = bookDto | ||
) | ||
} | ||
|
||
fun bookDto(title: String = "title1", withTags: Boolean = false): BookCreateDto { | ||
return BookCreateDto( | ||
id = null, | ||
title = title, | ||
isbn10 = "1566199093", | ||
isbn13 = "9781566199094 ", | ||
summary = "This is a test summary\nwith a newline", | ||
image = "", | ||
publisher = "test-publisher", | ||
pageCount = 50, | ||
publishedDate = "", | ||
series = "", | ||
authors = mutableListOf(authorDto()), | ||
numberInSeries = null, | ||
tags = if (withTags) tags() else emptyList(), | ||
goodreadsId = "4321abc", | ||
googleId = "1234", | ||
librarythingId = "", | ||
language = "", | ||
amazonId = "" | ||
) | ||
} | ||
|
||
fun authorDto(name: String = "test author"): AuthorDto { | ||
return AuthorDto(id = null, creationDate = null, modificationDate = null, name = name, image = "", dateOfBirth = "", dateOfDeath = "", biography = "author bio", facebookPage = null, goodreadsPage = null, instagramPage = null, notes = null, officialPage = null, twitterPage = null, wikipediaPage = "https://wikipedia.org") | ||
} | ||
|
||
fun tags(): List<TagDto> { | ||
val tags = mutableListOf<TagDto>() | ||
tags.add(tagDto()) | ||
tags.add(tagDto("fantasy")) | ||
return tags | ||
} | ||
|
||
fun tagDto(name: String = "science fiction"): TagDto { | ||
return TagDto(id = null, creationDate = null, modificationDate = null, name) | ||
} |
Oops, something went wrong.