Skip to content
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

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open

Add seeders for development #206

wants to merge 12 commits into from

Conversation

MRita443
Copy link
Collaborator

Review checklist

  • Behavior is as expected
  • Clean, well structured code
  • Properly documents API changes in the corresponding controller test
  • Contains enough appropriate tests
  • Changes are reflected in the Wiki if necessary

Copy link

Check the documentation preview: https://666b2ff156f07c79c91b0390--niaefeup-backend-docs.netlify.app

Copy link

Check the documentation preview: https://6674664aff107b90fe3e52c7--niaefeup-backend-docs.netlify.app

@MRita443
Copy link
Collaborator Author

Copy link

Check the documentation preview: https://67128f5518a026754a930d08--niaefeup-backend-docs.netlify.app

@Vidal322 Vidal322 marked this pull request as ready for review November 16, 2024 00:25
@Vidal322 Vidal322 requested a review from rubuy-74 November 16, 2024 00:26
Copy link

Check the documentation preview: https://6738d8b94d832f968e8c51f1--niaefeup-backend-docs.netlify.app

Copy link

Check the documentation preview: https://6738d9c423d885a842a0bd1b--niaefeup-backend-docs.netlify.app

Copy link

Check the documentation preview: https://6745c4db330f675ec1cb9751--niaefeup-backend-docs.netlify.app

Copy link
Collaborator Author

@MRita443 MRita443 left a 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

Comment on lines +20 to +27
fun checkSeedArgument() {
try {
val seedProperty = System.getProperty("seed")
if (seedProperty == "true") {
seed = true
}
} catch (_: NullPointerException) { } catch (_: IllegalArgumentException) {}
}
Copy link
Collaborator Author

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()
Copy link
Collaborator Author

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

Comment on lines +16 to +18
val debug: Boolean = true // false

var seed: Boolean = true // false
Copy link
Collaborator Author

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

Comment on lines +15 to +18
@Value("\${app.debug}")
val debug: Boolean = true // false

var seed: Boolean = true // false
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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

Copy link
Collaborator Author

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.seedon application.properties, or override whatever its value is (even null) if we run bootRun with ./gradlew bootRun -Pseed

Copy link
Collaborator Author

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.debugor app.seed are missing they are assumed false

@@ -1,3 +1,6 @@
# Application Settings
app.debug = true

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
app.seed = true

Comment on lines +70 to +74
// 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))
)
Copy link
Collaborator Author

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()
Copy link
Collaborator Author

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only one?

Comment on lines +22 to +38
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))
)
)
Copy link
Collaborator Author

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

@MRita443
Copy link
Collaborator Author

Btw I can't approve/disapprove because I opened the PR ;(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants