Commit Graph

44 Commits

Author SHA1 Message Date
Teriuihi 595e4eed27 Add fields for good builds, bad builds, and technical aspects
These new fields enhance the event application form data by capturing more detailed information about the applicant's building experience and technical skills. This update includes new validations and ensures these fields are incorporated into the `toString` and `toHtml` methods.
2024-10-06 00:53:21 +02:00
Teriuihi a3fcab1c4b Delete workspace.xml from version control
Deleted the .idea/workspace.xml file to prevent tracking IDE-specific settings in version control. This ensures that local development environment configurations remain private and do not interfere with team members' setups.
2024-09-20 18:06:06 +02:00
Teriuihi 36c736f8d3 Add Event Application Form handling
Introduced `EventAppController` and `EventAppFormData` classes to handle event application form submissions. Updated `FormQuery` to support the new form type. This enhancement allows users to submit event-related applications via the API while ensuring data validation and proper email communication.
2024-09-20 18:02:24 +02:00
Teriuihi 3eb4970407 Refactor toHtml() method in Form.java
Enhanced `toHtml()` to split multiline values into paragraphs using streams and filters. This improves HTML output readability by ensuring each line is wrapped in `<p>` tags. Also updated workspace.xml with the correct description for the recent changes.
2024-08-11 18:47:36 +02:00
Teriuihi ab74360571 Add IP address tracking for form submissions
Included IP and timestamp columns in the database schema to track form submissions. Updated methods to handle and store the IP information upon form submission. Adjusted related test cases to validate the new implementation.
2024-08-11 18:31:15 +02:00
Teriuihi fcda4c9e53 Update toHtml() method in Form.java
Simplified the HTML structure for the `toHtml` method by switching from a table layout to paragraph tags. This removes unnecessary table formatting for improved readability and maintainability. Also updated workspace.xml with task tracking and removed outdated comments.
2024-08-11 18:24:37 +02:00
Teriuihi 4a0aebce82 Improve email handling with Mailable interface
Added a new Mailable interface for extracting email-related data like receiver and subject. Updated StaffAppFormData and ContactFormData to implement this interface, and refactored MailForm to utilize these details. This enhances flexibility and decouples email details from form classes.
2024-08-11 18:21:16 +02:00
Teriuihi 47f6eebd8b Add branch condition to Discord notification stage
The Discord notification stage now runs only on 'main' or 'master' branches. This helps to avoid unnecessary notifications for feature or bugfix branches.
2024-08-11 18:10:36 +02:00
Teriuihi 1dbb80e5a2 Add @JsonIgnore annotations to sensitive methods
Added @JsonIgnore annotations to override methods in StaffAppFormData and ContactFormData classes to prevent them from being serialized.
2024-08-10 04:30:37 +02:00
Teriuihi ed098513f5 Change fields from final to mutable in form classes
Refactored `StaffAppFormData` and `ContactFormData` to allow updating fields by removing the `final` modifier. Added default constructors to both classes for easier instantiation and management. This change improves the flexibility and maintainability of the codebase.
2024-08-10 04:24:08 +02:00
Teriuihi 1a5be5021b Add JSON response handling for form activity check
Refactor `FormActiveController` to return JSON responses using `BooleanResponse`. Introduce exception handling for JSON processing errors and update `FormActiveData` to allow object initialization without parameters.
2024-08-10 03:10:02 +02:00
Teriuihi a9d4377599 Ensure NOT NULL constraints in SQL tables
Refactor SQL table creation scripts to add NOT NULL constraints where necessary. This change ensures data integrity by preventing null values in critical columns across the 'verify_form', 'form', 'rate_limit', and 'form_active' tables.
2024-08-10 02:32:47 +02:00
Teriuihi af44532d26 Add form activity checking and global rate limiting
Implemented new features to track form activity and enforce global rate limits. Added a `form_active` table and created endpoints to check form activity. Also, introduced a rate-limiting filter to restrict API requests to 30 per minute per IP.
2024-08-10 02:28:18 +02:00
Teriuihi fedb80f3c2 Refactor form request handling and add rate limiting.
Consolidate email verification logic into FormRequestHandler to simplify code maintenance. Implement a new rate limiting feature to restrict form submissions based on IP and email address, improving server security and performance.
2024-08-10 01:52:34 +02:00
Teriuihi f0c84e809f Add rate limiting functionality
Introduces a new 'rate_limit' table to track request counts by IP and email. Adds `RateLimitQuery` class for querying and inserting rate limits, and `RateLimitEntryDTO` for passing rate limit data.
2024-08-10 00:50:53 +02:00
Teriuihi 4f3db5ae8b workspace.xml update 2024-08-10 00:36:00 +02:00
Teriuihi c9fc81cfca Add StaffAppFormData handling in FormQuery
Imported StaffAppFormData and updated deserialization logic to include it as a case in the FormQuery class. This allows the processing of staff application forms when parsing form data from JSON.
2024-08-10 00:35:42 +02:00
Teriuihi 5e564fe9a7 Remove restriction on dot character in Discord name validation
This change allows Discord names to include dots anywhere within the name, increasing flexibility for valid usernames. The previous regex pattern incorrectly restricted dots, affecting valid user entries.
2024-08-10 00:35:29 +02:00
Teriuihi 9e0a33e782 Correct regex pattern for case-insensitive match
Updated the regex pattern in `StaffAppFormData.java` to ensure that the "yes" or "no" answers are case-insensitive. This improves the form validation to accept "Yes", "YES", "No", or "NO" without errors.
2024-08-07 21:34:25 +02:00
Teriuihi 514aaeb367 Refactor packages and add exception handler.
Renamed various classes to follow the "controlers" package structure for better organization and consistency. Added `ControllerExceptionHandler` to manage validation exceptions globally and improve error logging.
2024-08-07 21:34:03 +02:00
Teriuihi caabe7b923 Refactor form submission to use dynamic Discord URLs and emails
Updated form classes to return Optional URLs for Discord bot submissions. Refactored VerifyController to handle these Optionals and improved error handling when sending forms. Added receiver email method in form classes for more flexible form submissions.
2024-08-07 00:36:22 +02:00
Teriuihi f972436717 Add getDiscordBotUrl method to form classes
Implemented getDiscordBotUrl in form classes for dynamic URL handling. Updated VerifyController to use this method for constructing Discord bot URIs. This enhances flexibility and maintainability in form submission handling.
2024-08-07 00:01:15 +02:00
Teriuihi 2ad194fab2 Update Jackson config and refactor JSON handling
Introduced Jackson dependencies to replace Gson for JSON processing. Updated application properties and controllers to handle Jackson-specific exceptions. Refactored form serialization to use Jackson's `ObjectMapper` for better date handling and consistency.
2024-08-06 23:58:15 +02:00
Teriuihi 2c3cb48667 Add REST annotations and refactor properties file handling
Introduced `@RestController` and `@RequestMapping` in `StaffAppController` for standardized API endpoints. Refactored properties file handling in `PropertiesLoader` and `PropertiesWriter` to simplify file creation logic.
2024-08-06 23:17:06 +02:00
Teriuihi 04088c20e5 Update CORS allowed origins configuration
Consolidated the allowed origins into a single `allowedOrigins` call. This ensures both local and production environments are correctly configured for CORS.
2024-08-06 23:16:38 +02:00
Teriuihi 34255c93c8 Add REST annotations to StaffAppController
Introduce `@RestController` and `@RequestMapping` annotations to the `StaffAppController` class. This change standardizes the API endpoint and ensures all methods within this class are mapped correctly under `/api/apply`.
2024-08-06 22:23:04 +02:00
Teriuihi 01deea380a Add Staff Application Form handling
Introduced `StaffAppController` and `StaffAppFormData` to handle staff application form submissions. The controller now stores user data, initiates email verification, and provides appropriate responses based on the verification outcome. Additionally, updated `application.properties` and cleaned up IntelliJ workspace.xml.
2024-08-06 22:21:43 +02:00
Teriuihi d53ba82e3e Refactor HTML generation in ContactFormData
Extract the HTML generation logic to a reusable method in the Form class. This change reduces code duplication and enhances maintainability by centralizing the table generation functionality.
2024-08-06 22:21:30 +02:00
Teriuihi ac5448385d Rename StoreFormQuery package to forms.form
Updated the package name for consistency and better categorization. Adjusted imports in related test files to reflect the new package structure.
2024-08-06 22:21:07 +02:00
Teriuihi d8ab42b09c Update URI to point to Discord bot endpoint
Changed the URI in VerifyController to use the Discord bot's endpoint for form submission. This adjustment is part of the process to route form data correctly through the specified internal service.
2024-08-05 01:08:51 +02:00
Teriuihi 14f02e535f Enhance logging for mail verification details
Updated logging to provide more detailed information about user credentials and email actions. This helps in debugging and monitoring mail verification processes more effectively. Adjusted trace messages to include username and password for better traceability.
2024-08-05 01:03:12 +02:00
Teriuihi cbb5dd99d8 Refactor logging for better granularity
Updated logging levels in multiple classes to differentiate between debug and trace information. Improved log messages to support parameterized logs, ensuring sensitive or variable information is handled appropriately without concatenation.
2024-08-05 00:45:48 +02:00
Teriuihi f68a96c089 Add CORS support for production server
Updated the CORS configuration to include the production server URL. This change ensures that requests from the production environment are properly handled.
2024-08-05 00:23:06 +02:00
Teriuihi 8cb22aae08 Configure system property for conditional test execution
Added a system property 'doNotRunDatabaseTests' in the test configuration to allow conditional skipping of database tests. This helps in running tests selectively during different build scenarios.
2024-08-04 22:54:48 +02:00
Teriuihi 405c2a73bd Fix typo in Gradle build command in Jenkinsfile
Corrected the parameter for skipping database tests from `dontRunDatabaseTests` to `doNotRunDatabaseTests` in the Gradle build step. This ensures the intended tests are skipped during the build process.
2024-08-04 22:53:35 +02:00
Teriuihi cb7bb60178 Disable database tests in Jenkins
Disabled tests that require a database connection to prevent failures in Jenkins where there isn't a database. Updated Jenkinsfile to include a property that skips these tests during the build process.
2024-08-04 22:52:01 +02:00
Teriuihi 4c70082f67 Add Jenkins pipeline for Gradle build and notifications
This commit introduces a new Jenkinsfile configured to build the project using Gradle and archive the resulting artifacts. Additionally, it includes a stage to send build notifications to Discord with details about the build status.
2024-08-04 22:44:13 +02:00
Teriuihi ab9ec4127c Add DB config via command-line arguments
A new setup allows specifying database properties path using command-line arguments during startup. The `DatabaseConnection.initialize()` method signature has been updated to accept a path argument. Methods in `PropertiesLoader`, `PropertiesWriter`, and `MailSettings` classes, along with tests in the `TestForm` class, were adjusted accordingly.
2024-08-04 22:44:03 +02:00
Teriuihi 49af4a3067 Add database configuration via command-line arguments
A new configuration setup now allows specifying a path for database properties via command-line arguments during application startup. This update also changes the call signature for `DatabaseConnection.initialize()` method to accept a path argument. Similarly, methods in `PropertiesLoader`, `PropertiesWriter`, and `MailSettings` classes were also updated to use the specified path when working with properties files. The `TestForm` class's tests were updated accordingly to handle these changes.
2024-04-28 21:25:09 +02:00
Teriuihi 2f1d24598b Update Form HTML output and disable validation auto-configuration
The form-to-HTML output process has been switched from a `<div>` approach to using a `StringBuilder` with a table structure in `ContactFormData.java`. Also, the spring validation auto-configuration has been disabled by adding `exclude = ValidationAutoConfiguration.class` in the `@SpringBootApplication` annotation of `Main.java`. Some changes in `.idea/workspace.xml` and `VerifyController.java` were made as well.
2024-04-28 17:58:43 +02:00
Teriuihi 4ec41d8a7e Mark fields as final in VerificationData and ContactFormData
The 'code', 'eMail' fields in the VerificationData class and 'username', 'email', 'question' fields in the ContactFormData class are now marked as 'final'. At the same time, some unused imports from ContactController, ContactFormData, FormQuery, and VerifyController have been removed for code cleanliness.
2024-01-14 11:20:08 +01:00
Teriuihi 917965a33d Add TestForm class and set up related unit tests
The changes add a new TestForm class to implement unit tests for form handling in the application. The included tests verify the storing, retrieving, and verification of forms from a database, as well as form object creation and confirmation of form data. This is a step towards improving the code's reliability and making it easier to catch potential bugs or issues.
2024-01-14 11:09:35 +01:00
Teriuihi 0464281a38 Refactor code to use Form objects instead of JSON strings
Several parts of the code have been altered to use Form objects instead of JSON strings. Changes include updating the FormQueryResult record type to hold an Optional<Form> instead of an Optional<String>, altering methods in the StoreFormQuery class to insert Form data into the database and replacing JSON handling methods in the FormQuery class with Form object oriented methods. A 'form_class' field has also been added to the 'form' table in the database to aid form identification and reconstruction from stored data.
2024-01-14 11:09:22 +01:00
Teriuihi 2b908b4e94 Initial commit for site for forms 2024-01-13 16:24:54 +01:00