forked from hibobio/hibob-academy-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional indexes to feedback table (#52)
* Add additional indexes to the feedback table for improved query performance on employee_id, created_at, is_anonymous, department * DROP unnecessary INDEX idx_feedback_is_anonymous * DROP unnecessary INDEX idx_feedback_department * Validate strings length (#53) * Implement validation for feedback content * space after comma * change to BadRequestException
- Loading branch information
Showing
6 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
src/main/kotlin/com/hibob/academy/employee_feedback_feature/service/FeedbackService.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
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
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/hibob/academy/employee_feedback_feature/validation/ValidateSubmission.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,17 @@ | ||
package com.hibob.academy.employee_feedback_feature.validation | ||
|
||
import jakarta.ws.rs.BadRequestException | ||
|
||
class ValidateSubmission { | ||
companion object{ | ||
fun validateTextSubmission(submittedString: String, maxLength: Long): Boolean { | ||
if (submittedString.length > maxLength) { | ||
throw BadRequestException("Error: Input too long!") | ||
} | ||
if (submittedString.isEmpty()) { | ||
throw BadRequestException("Error: Empty Submission!") | ||
} | ||
return true | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/db/migration/V202409261405__add_indexes_to_feedback_table.sql
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,7 @@ | ||
CREATE INDEX IF NOT EXISTS idx_feedback_employee_id ON feedback (employee_id); | ||
|
||
CREATE INDEX IF NOT EXISTS idx_feedback_created_at ON feedback (created_at); | ||
|
||
CREATE INDEX IF NOT EXISTS idx_feedback_is_anonymous ON feedback (is_anonymous); | ||
|
||
CREATE INDEX IF NOT EXISTS idx_feedback_department ON feedback (department); |
1 change: 1 addition & 0 deletions
1
src/main/resources/db/migration/V202409261505__drop_idx_feedback_is_anonymous.sql
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 @@ | ||
DROP INDEX IF EXISTS idx_feedback_is_anonymous; |
1 change: 1 addition & 0 deletions
1
src/main/resources/db/migration/V202409261525__drop_idx_feedback_department.sql
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 @@ | ||
DROP INDEX IF EXISTS idx_feedback_department; |