Lint
This commit is contained in:
parent
1b79635ffa
commit
b90df61020
@ -45,5 +45,4 @@ object Config {
|
|||||||
host = value("host"),
|
host = value("host"),
|
||||||
port = value("port").toInt(),
|
port = value("port").toInt(),
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,6 @@ import org.koin.dsl.module
|
|||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import be.simplenotes.shared.config.ServerConfig as SimpleNotesServeConfig
|
import be.simplenotes.shared.config.ServerConfig as SimpleNotesServeConfig
|
||||||
|
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
val koin = startKoin {
|
val koin = startKoin {
|
||||||
modules(
|
modules(
|
||||||
|
|||||||
@ -29,16 +29,19 @@ class NoteController(
|
|||||||
|
|
||||||
val markdownForm = request.form("markdown") ?: ""
|
val markdownForm = request.form("markdown") ?: ""
|
||||||
|
|
||||||
return noteService.create(jwtPayload.userId, markdownForm).fold({
|
return noteService.create(jwtPayload.userId, markdownForm).fold(
|
||||||
|
{
|
||||||
val html = when (it) {
|
val html = when (it) {
|
||||||
MissingMeta -> view.noteEditor(jwtPayload, error = "Missing note metadata", textarea = markdownForm)
|
MissingMeta -> view.noteEditor(jwtPayload, error = "Missing note metadata", textarea = markdownForm)
|
||||||
InvalidMeta -> view.noteEditor(jwtPayload, error = "Invalid note metadata", textarea = markdownForm)
|
InvalidMeta -> view.noteEditor(jwtPayload, error = "Invalid note metadata", textarea = markdownForm)
|
||||||
is ValidationError -> view.noteEditor(jwtPayload, validationErrors = it.validationErrors, textarea = markdownForm)
|
is ValidationError -> view.noteEditor(jwtPayload, validationErrors = it.validationErrors, textarea = markdownForm)
|
||||||
}
|
}
|
||||||
Response(BAD_REQUEST).html(html)
|
Response(BAD_REQUEST).html(html)
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
Response.redirect("/notes/${it.uuid}")
|
Response.redirect("/notes/${it.uuid}")
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun list(request: Request, jwtPayload: JwtPayload): Response {
|
fun list(request: Request, jwtPayload: JwtPayload): Response {
|
||||||
@ -71,17 +74,19 @@ class NoteController(
|
|||||||
|
|
||||||
val markdownForm = request.form("markdown") ?: ""
|
val markdownForm = request.form("markdown") ?: ""
|
||||||
|
|
||||||
return noteService.update(jwtPayload.userId, note.uuid, markdownForm).fold({
|
return noteService.update(jwtPayload.userId, note.uuid, markdownForm).fold(
|
||||||
|
{
|
||||||
val html = when (it) {
|
val html = when (it) {
|
||||||
MissingMeta -> view.noteEditor(jwtPayload, error = "Missing note metadata", textarea = markdownForm)
|
MissingMeta -> view.noteEditor(jwtPayload, error = "Missing note metadata", textarea = markdownForm)
|
||||||
InvalidMeta -> view.noteEditor(jwtPayload, error = "Invalid note metadata", textarea = markdownForm)
|
InvalidMeta -> view.noteEditor(jwtPayload, error = "Invalid note metadata", textarea = markdownForm)
|
||||||
is ValidationError -> view.noteEditor(jwtPayload, validationErrors = it.validationErrors, textarea = markdownForm)
|
is ValidationError -> view.noteEditor(jwtPayload, validationErrors = it.validationErrors, textarea = markdownForm)
|
||||||
}
|
}
|
||||||
Response(BAD_REQUEST).html(html)
|
Response(BAD_REQUEST).html(html)
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
Response.redirect("/notes/${note.uuid}")
|
Response.redirect("/notes/${note.uuid}")
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Request.uuidPath(): UUID? {
|
private fun Request.uuidPath(): UUID? {
|
||||||
@ -92,5 +97,4 @@ class NoteController(
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,5 +110,4 @@ class UserController(
|
|||||||
|
|
||||||
fun logout(@Suppress("UNUSED_PARAMETER") request: Request) = Response.redirect("/")
|
fun logout(@Suppress("UNUSED_PARAMETER") request: Request) = Response.redirect("/")
|
||||||
.invalidateCookie("Authorization")
|
.invalidateCookie("Authorization")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class NoteView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
|
|||||||
ul {
|
ul {
|
||||||
notes.forEach { (title, tags, _, uuid) ->
|
notes.forEach { (title, tags, _, uuid) ->
|
||||||
li("flex justify-between") {
|
li("flex justify-between") {
|
||||||
a(classes = "text-blue-200 text-xl hover:underline", href = "/notes/${uuid}") {
|
a(classes = "text-blue-200 text-xl hover:underline", href = "/notes/$uuid") {
|
||||||
+title
|
+title
|
||||||
}
|
}
|
||||||
span {
|
span {
|
||||||
|
|||||||
@ -42,4 +42,3 @@ class NoteService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class PaginatedNotes(val pages: Int, val notes: List<PersistedNoteMetadata>)
|
data class PaginatedNotes(val pages: Int, val notes: List<PersistedNoteMetadata>)
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import org.yaml.snakeyaml.Yaml
|
|||||||
import org.yaml.snakeyaml.parser.ParserException
|
import org.yaml.snakeyaml.parser.ParserException
|
||||||
import org.yaml.snakeyaml.scanner.ScannerException
|
import org.yaml.snakeyaml.scanner.ScannerException
|
||||||
|
|
||||||
|
|
||||||
sealed class MarkdownParsingError
|
sealed class MarkdownParsingError
|
||||||
object MissingMeta : MarkdownParsingError()
|
object MissingMeta : MarkdownParsingError()
|
||||||
object InvalidMeta : MarkdownParsingError()
|
object InvalidMeta : MarkdownParsingError()
|
||||||
|
|||||||
@ -2,8 +2,6 @@ package be.simplenotes.domain.validation
|
|||||||
|
|
||||||
import arrow.core.*
|
import arrow.core.*
|
||||||
import be.simplenotes.domain.model.NoteMetadata
|
import be.simplenotes.domain.model.NoteMetadata
|
||||||
import be.simplenotes.domain.model.User
|
|
||||||
import be.simplenotes.domain.usecases.login.InvalidLoginForm
|
|
||||||
import be.simplenotes.domain.usecases.markdown.ValidationError
|
import be.simplenotes.domain.usecases.markdown.ValidationError
|
||||||
import io.konform.validation.Validation
|
import io.konform.validation.Validation
|
||||||
import io.konform.validation.jsonschema.maxItems
|
import io.konform.validation.jsonschema.maxItems
|
||||||
@ -32,5 +30,4 @@ internal object NoteValidations {
|
|||||||
return if (errors.isEmpty()) none()
|
return if (errors.isEmpty()) none()
|
||||||
else return ValidationError(errors).some()
|
else return ValidationError(errors).some()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import be.simplenotes.persistance.users.Users
|
|||||||
import me.liuwj.ktorm.database.*
|
import me.liuwj.ktorm.database.*
|
||||||
import me.liuwj.ktorm.entity.*
|
import me.liuwj.ktorm.entity.*
|
||||||
import me.liuwj.ktorm.schema.*
|
import me.liuwj.ktorm.schema.*
|
||||||
import java.time.Instant
|
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|||||||
@ -155,7 +155,6 @@ internal class NoteRepositoryImplTest {
|
|||||||
.hasSize(10)
|
.hasSize(10)
|
||||||
.allMatch { it.title.toInt() in 41..50 }
|
.allMatch { it.title.toInt() in 41..50 }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user