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

#119 Native Sublinks API #359

Open
wants to merge 132 commits into
base: main
Choose a base branch
from
Open

#119 Native Sublinks API #359

wants to merge 132 commits into from

Conversation

Pdzly
Copy link
Member

@Pdzly Pdzly commented Apr 24, 2024

Resolves #119

Implements #406 #425

@Pdzly Pdzly self-assigned this Apr 24, 2024
@Pdzly Pdzly linked an issue Apr 24, 2024 that may be closed by this pull request
This commit removes an unnecessary blank line in the PersonMapper class. The removal cleans up the code and improves its readability. This change adheres to the defined code style guide.
Pdzly added 2 commits April 26, 2024 17:30
…-native-api

# Conflicts:
#	src/main/java/com/sublinks/sublinksapi/api/lemmy/v3/site/controllers/SiteController.java
The code refactor involved updating PersonService's relevant methods and adjusting their arguments and properties. Alongside this, JSON Web Token (JWT) authentication has been implemented to secure APIs. A new process for person registration has also been introduced, which now includes email verification and handling different registration modes. New components such as JwtFilter, JwtUtil and JwtPerson have been included for managing JWTs, and a new timeline endpoint for default controller is also introduced.
jgrim
jgrim previously requested changes Apr 29, 2024
Copy link
Member

@jgrim jgrim left a comment

Choose a reason for hiding this comment

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

Please, add javadoc to classes and methods.

Pdzly added 6 commits May 2, 2024 08:25
…PI functionality

Made changes throughout the project by replacing primitive boolean with its Wrapper class, Boolean. This allows for null values, which can represent 'undefined' status. In addition, introduced new community-related endpoints and services, for enhanced community details management. Also, new SortType and ListingType enumerations were added, to enrich the sorting and listing options. Implemented relevant conversions and mapping for new types.
Added method to find Instance by domain in the InstanceRepository and find methods for Community in the CommunityRepository. Enhanced SublinksCommunityService to handle community updates, deletion and removal, and validate unique titleSlugs upon creation. Also introduced ActorIdUtils for handling actorIDs.
Added SublinksCommentService for handling comment creation with proper validations and exception handling. Adjusted RoleAuthorizingService by introducing helper methods to check a person's permission status. Updated CommunityModActionsController with refined exception handling logic. Added necessary find methods in PostRepository and CommentRepository. Introduced new model classes for comments.
CommunityRepository has been refactored to use Optional for the return type of findCommunityByTitleSlug method to better handle absence of value situations. Additionally, logic has been added in createCommunity and updateCommunity methods to check user permissions for these operations. The updateCommunity method has also been simplified for better readability and efficiency.
Pdzly added 18 commits August 9, 2024 18:38
Previously, the pagination could start at an invalid state due to using zero as the lower bound. This change ensures that pagination correctly starts at page 1 instead of 0.

Signed-off-by: rooki <[email protected]>
Introduced SublinksCommentSortTypeMapper to map SortType to CommentSortType. Refactored SublinksCommentService for improved sortType and listingType handling, ensuring null checks and default value assignments. Removed redundant imports in the affected classes.

Signed-off-by: rooki <[email protected]>
Updated the Comment entity to have a nullable searchVector, modified service logic for saving comments, and added toBuilder for CommentResponse. Refactored SublinksRoleMapper usage and improved formatting consistency in service classes.

Signed-off-by: rooki <[email protected]>
Removed the `replies` field and associated annotations from the `CommentResponse` model. Updated dependent mappers and services to reflect this change. This simplifies the comment structure and reduces unnecessary data handling.

Signed-off-by: rooki <[email protected]>
The @builder annotation was removed from the CommentResponse record. This change likely addresses redundancy or issues caused by the builder pattern in this specific context.

Signed-off-by: rooki <[email protected]>
Added InstanceResponse to PersonResponse model and integrated ACL service in person search for better permissions handling. Refactored pagination and search methods, optimizing query execution, and cleaned up unused imports.

Signed-off-by: rooki <[email protected]>
Implemented a tree structure for handling comment replies, enabling nested comment representation. Removed unused dependencies and redundant fields in various controllers and services for better code maintainability. Also adjusted mappers to accommodate new replies structure, improving overall data handling.

Signed-off-by: rooki <[email protected]>
Updated the JavaDoc to specify that comments without replies or missing parents are placed at the end of the list. This documentation update ensures developers understand the behavior when organizing comments into a hierarchy.

Signed-off-by: rooki <[email protected]>
Corrected the documentation comment in the build comment tree method. This ensures the explanation for the comment reply structure is clear and complete, aiding future maintenance and understanding.

Signed-off-by: rooki <[email protected]>
Corrected description to clarify handling of comments with no parent or missing parent in the list. This ensures better understanding of how orphaned comments are treated in the tree building process.

Signed-off-by: rooki <[email protected]>
Refactored pagination handling into utility methods in `PaginationUtils` for consistency and reusability. Updated SQL query in `InstanceRepository` to correct syntax and improve domain search functionality. Enhanced readability by simplifying instance response conversion logic in `SublinksInstanceService`.

Signed-off-by: rooki <[email protected]>
Standardized the naming of API tags across multiple controllers for clarity. Refactored exception handling to use the `orThrowUnauthorized` method, reducing redundancy in authorization checks.

Signed-off-by: rooki <[email protected]>
Introduced Swagger annotations for `CreateCommunity`, `DeleteCommunity`, and `IndexCommunity` models. This improves API documentation by providing detailed descriptions and default values for relevant fields. These changes enhance developer understanding and API usability.

Signed-off-by: rooki <[email protected]>
Added Swagger annotations to fields in `CommentResponse` and `UpdateComment` for improved API documentation clarity. Annotations provide thorough descriptions and specify required fields, enhancing the maintainability and user comprehension of the API.

Signed-off-by: rooki <[email protected]>
Added Swagger annotations to enhance API documentation across multiple community and comment models. Renamed `AggregateCommentResponse` to `CommentAggregateResponse` for consistency and updated the relevant references in the service and controller files. Also included title update handling in the Community service logic.

Signed-off-by: rooki <[email protected]>
Corrected the indentation in the aggregate method to improve code readability. This change ensures consistent formatting and maintains coding standards.

Signed-off-by: rooki <[email protected]>
Refactored the SublinksCommentModerationController by removing the unused RolePermissionService dependency. This cleanup simplifies the code and removes redundant imports, enhancing maintainability.

Signed-off-by: rooki <[email protected]>
@Pdzly Pdzly marked this pull request as ready for review August 26, 2024 19:33
@Pdzly Pdzly requested a review from a team as a code owner August 26, 2024 19:33
Introduced token field and related methods for handling user sessions. Added endpoints for managing session invalidation and logout, enhancing session control functionalities.

Signed-off-by: rooki <[email protected]>
Standardized formatting in the SublinksAnnouncementService class to enhance readability and maintain consistency. Primarily adjusted spacing in conditional statements and response status exception lambdas.

Signed-off-by: rooki <[email protected]>
@Pdzly Pdzly dismissed jgrim’s stale review September 23, 2024 06:25

All requests applied

Pdzly added 6 commits October 12, 2024 16:20
Included the JWT token in the SublinksJwtPerson object to ensure the token is accessible during authentication. This improvement enhances the security context by embedding the token with user authorities.

Signed-off-by: rooki <[email protected]>
Signed-off-by: rooki <[email protected]>
Updated the URL of the 'docker' submodule to use HTTPS instead of SSH, pointing to a new repository. This change affects the '.gitmodules' file to reference the new repository location.

Signed-off-by: rooki <[email protected]>
Updated the URL of the 'docker' submodule to use HTTPS instead of SSH, pointing to a new repository. This change affects the '.gitmodules' file to reference the new repository location.

Signed-off-by: rooki <[email protected]>
The password field from createPersonForm is now included when building a new Person object. This ensures the password gets encrypted as part of the person creation process.

Signed-off-by: rooki <[email protected]>
Added checks to return "invalid_token" error if JWT validation fails in both JwtFilter and SublinksJwtFilter classes. Simplified AddAdmin model by adjusting constructor format.

Signed-off-by: rooki <[email protected]>
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.

Sublinks Native API
3 participants