Skip to content

User profiles#29

Draft
tomast1337 wants to merge 28 commits intodevelopfrom
feature/user-profile
Draft

User profiles#29
tomast1337 wants to merge 28 commits intodevelopfrom
feature/user-profile

Conversation

@tomast1337
Copy link
Copy Markdown
Member

@tomast1337 tomast1337 commented Jan 12, 2025

This PR adds comprehensive features to enhance user profile management and songs and user search functionality

Planned Features:

  • Song search functionality based on keywords

  • User profile search functionality based on keywords

  • User profile pages for viewing member information

  • Profile editing interface for users to manage their details

Nice examples of profiles

Useful links about text search in MongoDB:

@tomast1337 tomast1337 self-assigned this Jan 12, 2025
@tomast1337
Copy link
Copy Markdown
Member Author

tomast1337 commented Jan 15, 2025

@Bentroen
For the user search feature, I created this search box, I assume the same search box can be repurposed for a song search feature, Does this approach seem suitable?

search

@tomast1337 tomast1337 added the help wanted Extra attention is needed label Jan 21, 2025
@tomast1337
Copy link
Copy Markdown
Member Author

@Bentroen To implement a search feature for users and songs is harder than I imagined.

I have a few worries about How efficient searching by keyword, name, title, author, and description by section or substring can be. And, how could we avoid full reads in case some user requests?

@tomast1337 tomast1337 changed the title Feat (profiles): Implement user-profiles and search functionality [WIP] Feat (profiles): Implement user-profiles and user and song search [WIP] Jan 21, 2025
@tomast1337
Copy link
Copy Markdown
Member Author

https://www.mongodb.com/resources/basics/full-text-search

I guess this is the approach to be taken with MongoDB, it already take care of all of this like fuzzy search and indexing is bazeds on words and not full strings.

@Bentroen Bentroen changed the title Feat (profiles): Implement user-profiles and user and song search [WIP] User profiles; user and song search [WIP] Feb 19, 2025
@Bentroen Bentroen marked this pull request as draft February 20, 2025 22:52
@Bentroen
Copy link
Copy Markdown
Member

Bentroen commented Mar 3, 2025

Thanks for working on these features!

@Bentroen For the user search feature, I created this search box, I assume the same search box can be repurposed for a song search feature, Does this approach seem suitable?

Yes, we can have a single search feature that can return results for both users and channels - selectable with a tab widget, similar to what YouTube does.
For simplicity, and since song search would be more useful than searching for users at first, we could implement search only for songs, and leave user search for a later stage.
(It seems like searching for channel is not very common compared to video search, so even YT relegated this option to a separate popup):

I have a few worries about How efficient searching by keyword, name, title, author, and description by section or substring can be. And, how could we avoid full reads in case some user requests?

Since user profiles are such a simple feature compared to search, I believe this PR can be reduced in scope to just user profiles, since they don't rely on search being ready to be merged into production. We can leverage the existing search infrastructure implemented here in a subsequent PR.

@Bentroen Bentroen changed the title User profiles; user and song search [WIP] User profiles Mar 3, 2025
…ator

- Add env, Discord strategy, and song form schemas to @nbw/validation
- Wire ConfigModule to validateEnv; parse user/song/query payloads with Zod
- Replace DTO class helpers with mappers in song.util; re-export validation from @nbw/database for consumers
- Frontend: import song form schemas from @nbw/validation; remove local SongForm.zod
- Remove class-validator/class-transformer and global ValidationPipe from backend
- Update specs; note bun test may need workspace resolution fixes for @nbw/config
- Introduce a new jsonStringField function to validate and parse JSON strings, ensuring invalid JSON surfaces as a Zod issue.
- Update thumbnailData and customInstruments fields to utilize jsonStringField for improved validation.
…instructions

- Change package name to @nbw/validation and clarify its role as the source of shared Zod schemas and TypeScript types.
- Add detailed layout and script sections for building, developing, testing, linting, and cleaning the package.
- Include instructions for consumers on how to import and use the package after building.
- Delete jest.config.js as part of the cleanup process for the validation package.
…TO names

Remove common/types.ts and song/types.ts (PageQueryDTOType and *DtoType aliases).
Add song/uploadMeta.ts for VisibilityType, CategoryType, LicenseType, TimespanType.
Export SongsFolder from SongPage.dto.ts next to SongPageDto.

Point SongPreview/SongView/UploadSongDto at uploadMeta; update package index exports.
Rename frontend imports from *DtoType to the real DTO types (via @nbw/database).
…ckage dependencies

- Introduced new UI components: Button, Input, Label, and Textarea for consistent styling and functionality across the application.
- Added @radix-ui/react-label dependency to package.json for label component integration.
- Updated existing components to utilize the new UI components for improved user experience.
- Refactored ProfileBioEditor and ProfilePublicNameEditor to use the new Input and Button components.
@tomast1337 tomast1337 force-pushed the feature/user-profile branch from 9b0e525 to fb03997 Compare April 18, 2026 00:49
- Changed the order field in PageQuery DTO from a union of boolean and string to an enum with 'asc' and 'desc' options for improved clarity and validation.
…ewSource type

- Updated song retrieval logic to use a more specific type for the uploader field in the song model.
- Introduced the SongPreviewSource type to standardize the structure of song preview data.
- Refactored songPreviewFromSongDocumentWithUser function to accept the new type for improved type safety and clarity.
- Changed various imports across the frontend application to source DTOs and types from the new @nbw/validation package instead of @nbw/database.
- This refactor aims to centralize validation logic and improve type safety throughout the application.
…e SongSearchParams

- Updated the SearchSongPage component to utilize the new SongSearchParams type for improved type safety.
- Refactored search logic to use constants from the SEARCH_SONGS configuration for pagination and placeholder counts.
- Cleaned up unused interfaces and enums, streamlining the codebase for better maintainability.
- Introduced a new SongSearchParams DTO to standardize search parameters across the application.
… from @nbw/config

- Removed the config-shim.ts file and updated imports in various DTOs to directly source constants from @nbw/config.
- This change simplifies the import structure and enhances clarity across the validation package.
…ring

- Modified the UserController to return paginated user data filtered by email, ID, or username.
- Updated the UserService to handle pagination and filtering logic, ensuring consistent query handling.
- Adjusted tests to reflect the new functionality and ensure proper coverage for paginated user retrieval.
- Removed deprecated lookup mode handling for a more streamlined approach to user queries.
- Removed unnecessary import of UserIndexQueryDto and updated the getUserIndex method to directly use UserIndexPageQueryInput.
- Streamlined the user retrieval logic for improved clarity and maintainability.
…constraints

- Introduced maximum length constraints for title, originalAuthor, and description fields in the Song entity using UPLOAD_CONSTANTS.
- Simplified the songPreviewFromSongDocumentWithUser function to default the description to an empty string if not provided.
- Updated the SongPreview DTO to reflect the new maximum length validations for title, originalAuthor, and description fields.
…pdate package dependencies"

This reverts commit fb03997.
- Updated import statements across multiple DTO files to remove the '.js' extension for consistency and clarity.
- This change enhances maintainability and aligns with best practices for module imports.
- Removed the mongoose dependency from the validation package to streamline dependencies.
- Updated import statements in SongSearchQuery.dto.ts to reference the correct path without the file extension, enhancing consistency and maintainability.
…update package dependencies"

This reverts commit acbe421.
@tomast1337 tomast1337 force-pushed the feature/user-profile branch from b9bbb9c to 78222d3 Compare April 21, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants