-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split FrontendRoutes on two enums (#2866)
* Split FrontendRoutes on two enums
- Loading branch information
1 parent
325aef9
commit 7a7e833
Showing
38 changed files
with
197 additions
and
164 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...-cloud-common/src/commonMain/kotlin/com/saveourtool/save/validation/FrontendCosvRoutes.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,63 @@ | ||
/** | ||
* Names that are used as endpoints in the frontend. | ||
* If you create a new view with new URL - add it here. | ||
*/ | ||
|
||
package com.saveourtool.save.validation | ||
|
||
import com.saveourtool.save.utils.URL_PATH_DELIMITER | ||
import kotlin.js.JsExport | ||
|
||
/** | ||
* @property path substring of url that defines given route | ||
*/ | ||
@JsExport | ||
enum class FrontendCosvRoutes(val path: String) { | ||
ABOUT_US("about"), | ||
BAN("ban"), | ||
COOKIE("cookie"), | ||
ERROR_404("404"), | ||
MANAGE_ORGANIZATIONS("organizations"), | ||
NOT_FOUND("not-found"), | ||
PROFILE("profile"), | ||
REGISTRATION("registration"), | ||
SETTINGS_DELETE("$SETTINGS/delete"), | ||
SETTINGS_EMAIL("$SETTINGS/email"), | ||
SETTINGS_ORGANIZATIONS("$SETTINGS/organizations"), | ||
SETTINGS_PROFILE("$SETTINGS/profile"), | ||
SETTINGS_TOKEN("$SETTINGS/token"), | ||
TERMS_OF_USE("terms-of-use"), | ||
THANKS_FOR_REGISTRATION("thanks-for-registration"), | ||
VULN("vuln"), | ||
VULNERABILITIES("$VULN/list"), | ||
VULNERABILITY_SINGLE("$VULN/collection"), | ||
VULN_COSV_SCHEMA("$VULN/schema"), | ||
VULN_CREATE("$VULN/create-vulnerability"), | ||
VULN_TOP_RATING("$VULN/top-rating"), | ||
VULN_UPLOAD("$VULN/upload-vulnerability"), | ||
; | ||
|
||
override fun toString(): String = path | ||
|
||
companion object { | ||
/** | ||
* List of views on which topbar should not be rendered | ||
*/ | ||
val noTopBarViewList = arrayOf( | ||
REGISTRATION, | ||
ERROR_404, | ||
TERMS_OF_USE, | ||
THANKS_FOR_REGISTRATION, | ||
) | ||
|
||
/** | ||
* Get forbidden words from [FrontendCosvRoutes]. | ||
* | ||
* @return list of forbidden words | ||
*/ | ||
fun getForbiddenWords() = FrontendCosvRoutes.values() | ||
.map { it.path.split(URL_PATH_DELIMITER) } | ||
.flatten() | ||
.toTypedArray() | ||
} | ||
} |
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
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
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
Oops, something went wrong.