-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add seeders for development #206
base: develop
Are you sure you want to change the base?
Conversation
Co-authored-by: Luís Duarte <[email protected]>
Check the documentation preview: https://666b2ff156f07c79c91b0390--niaefeup-backend-docs.netlify.app |
Check the documentation preview: https://6674664aff107b90fe3e52c7--niaefeup-backend-docs.netlify.app |
Check the documentation preview: https://67128f5518a026754a930d08--niaefeup-backend-docs.netlify.app |
Check the documentation preview: https://6738d8b94d832f968e8c51f1--niaefeup-backend-docs.netlify.app |
Check the documentation preview: https://6738d9c423d885a842a0bd1b--niaefeup-backend-docs.netlify.app |
Check the documentation preview: https://6745c4db330f675ec1cb9751--niaefeup-backend-docs.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Left some suggestions and questions
fun checkSeedArgument() { | ||
try { | ||
val seedProperty = System.getProperty("seed") | ||
if (seedProperty == "true") { | ||
seed = true | ||
} | ||
} catch (_: NullPointerException) { } catch (_: IllegalArgumentException) {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not being used we can remove it
|
||
override fun run(args: ApplicationArguments?) { | ||
logger.info("Running Startup hook...") | ||
// checkSeedArgument() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove here as well
val debug: Boolean = true // false | ||
|
||
var seed: Boolean = true // false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think both of these should be false
here by default
@Value("\${app.debug}") | ||
val debug: Boolean = true // false | ||
|
||
var seed: Boolean = true // false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Value("\${app.debug}") | |
val debug: Boolean = true // false | |
var seed: Boolean = true // false | |
@Value("\${app.debug:false}") | |
val debug: Boolean = false | |
@Value("\${app.seed:false}") | |
private var configSeed: Boolean = false | |
val seed: Boolean | |
get() = System.getProperty("seed")?.toBooleanStrictOrNull() ?: configSeed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would allow us to either specify app.seed
on application.properties
, or override whatever its value is (even null) if we run bootRun with ./gradlew bootRun -Pseed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also defaults to if app.debug
or app.seed
are missing they are assumed false
@@ -1,3 +1,6 @@ | |||
# Application Settings | |||
app.debug = true | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app.seed = true |
// Role: Admin/Settings Access Only | ||
// This role grants users administrative access to settings and superuser functionalities, but not permissions to manage accounts or activities. | ||
PerActivityRole( | ||
permissions = Permissions(setOf(Permission.EDIT_SETTINGS, Permission.SUPERUSER)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a repeat from above
perActivityRoles.map { entityManager.merge(it) }.toMutableList() | ||
|
||
val projects = (1..6).map { | ||
val title = faker.company().bs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂 appropriate
.replace(" ", "-") | ||
.replace(Regex("[^a-z0-9-]"), "") | ||
|
||
// Ensure only one TimeLineEvent per project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only one?
val roles = listOf( | ||
Role( | ||
name = "President", | ||
isSection = true, | ||
permissions = Permissions(listOf(Permission.EDIT_ACTIVITY)) | ||
), | ||
Role( | ||
name = "Vice President", | ||
isSection = true, | ||
permissions = Permissions(listOf(Permission.EDIT_ACTIVITY)) | ||
), | ||
Role( | ||
name = "Member", | ||
isSection = false, | ||
permissions = Permissions(listOf(Permission.VIEW_ACTIVITY)) | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be a couple more sections (isSection = true
) to test the frontend, and maybe make them match the frontend for it to be less confusing! (Aka Direção Membros Recrutas Alumni)
@@ -6,6 +9,7 @@ spring.datasource.password= | |||
# Spring JPA | |||
spring.jpa.hibernate.ddl-auto=update | |||
spring.jpa.open-in-view=false | |||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
Btw I can't approve/disapprove because I opened the PR ;( |
Review checklist