Skip to content

feat: migrate identifier from Long id to String resourceId and refactor persistence model - #23

Merged
roll-w merged 6 commits into
masterfrom
refactor/new-id
Apr 5, 2026
Merged

feat: migrate identifier from Long id to String resourceId and refactor persistence model#23
roll-w merged 6 commits into
masterfrom
refactor/new-id

Conversation

@roll-w

@roll-w roll-w commented Mar 29, 2026

Copy link
Copy Markdown
Owner

This pull request refactors the article domain model and persistence layer by replacing the numeric Long-based identifier with a string-based resourceId. It standardizes entity naming, updates repository contracts, and improves flexibility and extensibility of article identification.

Highlights

Backend

  • Migrated primary identifier from Long id to String resourceId across the domain model and persistence layer.
  • Revised repository and DAO interfaces to operate on String identifiers, including query methods and specifications.
  • Adjusted conversion logic between domain and persistence models to align with the new identifier scheme.

Frontend

None

Fixes

Backend

  • Improved naming consistency across entity fields (e.g., column naming such as createTime).

Frontend

None

Breaking Changes

  • All APIs, repositories, and internal logic that previously depended on Long id must migrate to String resourceId.
  • Any external integrations or stored references using numeric IDs may require migration.

Other Changes

  • Minor refactoring for code consistency and readability.

…nsistency

This refactor updates various content-related classes and interfaces
to use String instead of Long for content IDs. This change aims to
standardize the handling of content identifiers across the codebase,
improving consistency and potentially simplifying future integrations
 with external systems that may use string-based IDs.

BREAKING CHANGE: The content ID type has changed from Long to String,
 which may affect existing implementations relying on Long IDs.
@roll-w roll-w self-assigned this Mar 29, 2026
@roll-w roll-w added the enhancement New feature or request label Mar 29, 2026
@roll-w
roll-w requested a review from Copilot March 29, 2026 07:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates content-centric identifiers from Long id to String resourceId across the backend, updating Liquibase migrations, persistence entities/repositories, and API/controller models to support string-based IDs.

Changes:

  • Added Liquibase migrations to introduce/backfill resource_id columns and convert several FK-like ID columns to VARCHAR(64).
  • Refactored persistence/domain models and repository contracts across content, comment, favorite, system-setting, localized-message, and registration-token flows to use String identifiers.
  • Updated web controllers and view/VO types to accept and return String IDs.

Reviewed changes

Copilot reviewed 89 out of 89 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lampray-web/src/main/resources/db/changelog/0.1.0/0.1.0-alpha1-02-resource-id-migration.yaml Adds/backfills resource_id columns and changes ID column types to VARCHAR(64) for migration.
lampray-web/src/main/resources/db/changelog/0.1.0/0.1.0-alpha1-01-changelog.yaml Adjusts initial schema changeSet (notably user_personal_data PK column naming).
lampray-web/src/main/resources/db/changelog.yaml Includes the new resource-id migration changelog in the incremental context.
lampray-web/src/main/resources/db/baseline/baseline-0.1.0-alpha1.yaml Updates baseline schema to align with resource_id/VARCHAR(64) IDs and user_id PK naming.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/review/model/ReviewJobView.kt Switches review-job contentId view field to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/review/model/ReviewJobDetailsView.kt Switches review-job contentId view field to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/review/model/ReviewJobContentView.kt Switches review-job contentId view field to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/content/vo/ContentVo.java Changes ContentVo.id() contract from long to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/content/ContentManageController.java Updates admin content endpoint path variable contentId to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/content/ContentController.java Updates content endpoints and system resource operator generics to String IDs; converts userId to string for collection identity.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/comment/model/CommentVo.kt Changes comment view identifiers to String and parent to String?.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/comment/model/CommentRequest.java Changes comment request parent from Long to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/comment/CommentController.kt Updates comment endpoints to accept String contentId; uses string collection identities for user comments.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/article/model/ArticleVo.java Changes article id in API model from long to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/article/model/ArticleMetaVo.java Changes article id in API model from long to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/article/model/ArticleInfoView.java Changes article id in API model from long to String.
lampray-web/src/main/java/tech/lamprism/lampray/web/controller/article/ArticleManageController.java Updates admin article endpoint to accept String articleId.
lampray-web/src/main/java/tech/lamprism/lampray/system/database/LiquibaseInitializeConfiguration.java Adds baseline checksum refresh logic and adjusts normal-upgrade sync flow.
lampray-user/user-details-service/src/main/java/tech/lamprism/lampray/user/details/service/Utils.kt Renames persistence type usage from UserPersonalDataDo to UserPersonalDataEntity.
lampray-user/user-details-service/src/main/java/tech/lamprism/lampray/user/details/service/UserPersonalDataServiceImpl.java Updates repository access patterns for renamed entity and userId-based lookups.
lampray-user/user-details-service/src/main/java/tech/lamprism/lampray/user/details/persistence/UserPersonalDataRepository.kt Updates repository generic types and adds userId-based query methods.
lampray-user/user-details-service/src/main/java/tech/lamprism/lampray/user/details/persistence/UserPersonalDataEntity.kt Renames entity class and maps PK to user_id.
lampray-user/user-details-service/src/main/java/tech/lamprism/lampray/user/details/persistence/UserPersonalDataDao.kt Updates DAO generic types and adds userId query methods.
lampray-user/user-details-api/src/main/java/tech/lamprism/lampray/user/details/UserPersonalData.java Aligns getEntityId() and builder behavior with userId-based entity identity.
lampray-system/setting-service/src/main/java/tech/lamprism/lampray/setting/service/SystemSettingConfigProvider.kt Generates/stores resourceId when creating new settings entities.
lampray-system/setting-service/src/main/java/tech/lamprism/lampray/setting/data/SystemSettingRepository.kt Switches repository identity type to String and entity type to SystemSettingEntity.
lampray-system/setting-service/src/main/java/tech/lamprism/lampray/setting/data/SystemSettingEntity.kt Refactors system setting persistence to use resource_id as JPA identifier while retaining numeric id.
lampray-system/setting-service/src/main/java/tech/lamprism/lampray/setting/data/SystemSettingDao.kt Updates DAO generic types to SystemSettingEntity, String.
lampray-system/setting-service/src/main/java/tech/lamprism/lampray/setting/SystemSetting.java Refactors domain object to DataEntity<String> with resourceId and retains numeric id.
lampray-system/message-resource-service/src/main/java/tech/lamprism/lampray/system/resource/service/LocalizedMessageResourceService.kt Generates/stores resourceId for localized messages and updates entity usage.
lampray-system/message-resource-service/src/main/java/tech/lamprism/lampray/system/resource/data/LocalizedMessageRepository.kt Switches repository identity type to String and updates criteria to use explicit field names.
lampray-system/message-resource-service/src/main/java/tech/lamprism/lampray/system/resource/data/LocalizedMessageEntity.kt Refactors localized message persistence to use resource_id as JPA identifier and retains numeric id.
lampray-system/message-resource-service/src/main/java/tech/lamprism/lampray/system/resource/data/LocalizedMessageDao.kt Updates DAO generic types to LocalizedMessageEntity, String.
lampray-system/message-resource-service/src/main/java/tech/lamprism/lampray/system/resource/LocalizedMessage.kt Refactors domain object to DataEntity<String> and introduces resourceId.
lampray-iam/authentication-service/src/main/java/tech/lamprism/lampray/security/authentication/registration/service/LoginRegisterService.java Generates/stores resourceId for register tokens and updates persistence type usage.
lampray-iam/authentication-service/src/main/java/tech/lamprism/lampray/security/authentication/registration/repository/RegisterTokenRepository.kt Switches repository identity type to String and updates criteria to use explicit field names.
lampray-iam/authentication-service/src/main/java/tech/lamprism/lampray/security/authentication/registration/repository/RegisterTokenEntity.kt Refactors register token persistence to use resource_id as JPA identifier while retaining numeric id.
lampray-iam/authentication-service/src/main/java/tech/lamprism/lampray/security/authentication/registration/repository/RegisterTokenDao.kt Updates DAO generic types to RegisterTokenEntity, String.
lampray-iam/authentication-service/src/main/java/tech/lamprism/lampray/security/authentication/registration/RegisterVerificationToken.java Refactors token domain record to DataEntity<String> with explicit resourceId.
lampray-content/review-service/src/main/java/tech/lamprism/lampray/content/review/persistence/ReviewTaskEntity.kt Renames mapping conversion function to toEntity() for consistency.
lampray-content/review-service/src/main/java/tech/lamprism/lampray/content/review/persistence/ReviewJobRepository.kt Updates review job queries to use String contentId.
lampray-content/review-service/src/main/java/tech/lamprism/lampray/content/review/persistence/ReviewJobEntity.kt Refactors review job persistence content_id to String and renames conversion function to toEntity().
lampray-content/review-service/src/main/java/tech/lamprism/lampray/content/review/feedback/ReviewCategory.kt Simplifies review feedback categories (enum values removed).
lampray-content/review-service/src/main/java/tech/lamprism/lampray/content/review/ReviewJob.java Refactors review content id from long to String in domain object and builder.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/service/ContentService.java Updates content metadata persistence to String resourceId and generates ids on publish.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/service/ContentMetadataServiceImpl.kt Switches persistence conversion helper from toDo() to toEntity().
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/persistence/ContentMetadataRepository.kt Switches repository identity type to String and updates criteria types for contentId/contentType.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/persistence/ContentMetadataEntity.kt Refactors content metadata persistence to use resource_id as JPA identifier while retaining numeric id.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/persistence/ContentMetadataDao.kt Updates DAO generic types to ContentMetadataEntity, String.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/favorite/persistence/FavoriteItemRepository.kt Switches repository identity type to String and flushes on save/saveAll.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/favorite/persistence/FavoriteItemEntity.kt Refactors favorite item persistence to use resource_id as JPA identifier and converts group/content ids to String.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/favorite/persistence/FavoriteItemDao.kt Updates DAO generic types to FavoriteItemEntity, String.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/favorite/persistence/FavoriteGroupRepository.kt Switches repository identity type to String and updates criteria to explicit field names.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/favorite/persistence/FavoriteGroupEntity.kt Refactors favorite group persistence to use resource_id as JPA identifier; removes custom HibernateProxy equality.
lampray-content/content-service/src/main/java/tech/lamprism/lampray/content/favorite/persistence/FavoriteGroupDao.kt Updates DAO generic types to FavoriteGroupEntity, String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/service/ContentProvideService.java Updates system-resource provider/operator factory to use String ids.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/service/AbstractContentOperator.java Updates getContentId() signature to return String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/favorite/FavoriteProvider.java Updates favorite provider APIs to accept String ids.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/favorite/FavoriteItem.java Refactors favorite item domain entity to DataEntity<String> with resourceId.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/favorite/FavoriteGroupOperator.java Updates operator/system-resource generics to String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/favorite/FavoriteGroup.java Refactors favorite group domain entity to DataEntity<String> with resourceId.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/collection/SimpleContentCollectionIdentity.java Changes collection identity id type from long to String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/collection/ContentCollectionMetadata.java Refactors collection metadata contentId type to String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/collection/ContentCollectionIdentity.java Changes collection identity contract to String ids.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/collection/ContentCollectionDetails.java Refactors collection details getContentId() to return String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/collection/ContentCollection.java Updates getContentCollectionId() to return String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/SimpleContentInfo.java Refactors contentId to String in simple content representation.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/SimpleContentIdentity.java Refactors content identity to use String contentId.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/SimpleContentDetails.java Refactors content details id to String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/ContentTrait.java Updates content trait contract to use String contentId.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/ContentOperator.java Updates operator/system-resource generics to String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/ContentMetadataDetails.java Refactors content metadata details getContentId() to return String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/ContentMetadata.java Refactors content metadata domain entity to DataEntity<String> with resourceId and String contentId.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/ContentIdentity.java Updates content identity/system resource generics and factory method to use String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/ContentDetails.java Updates content details getContentId() to return String.
lampray-content/content-api/src/main/java/tech/lamprism/lampray/content/Content.java Updates content contract and factory method to use String contentId.
lampray-content/comment-service/src/main/java/tech/lamprism/lampray/content/comment/service/CommentService.java Generates comment resourceId, changes parent/comment-on id handling to String, and adds user-comments collection support.
lampray-content/comment-service/src/main/java/tech/lamprism/lampray/content/comment/service/CommentContentProvider.kt Switches persistence conversion helper from toDo() to toEntity().
lampray-content/comment-service/src/main/java/tech/lamprism/lampray/content/comment/persistence/CommentRepository.kt Switches repository identity type to String, updates query specs, and adds userId lookup.
lampray-content/comment-service/src/main/java/tech/lamprism/lampray/content/comment/persistence/CommentEntity.kt Refactors comment persistence to use resource_id as JPA identifier and converts parent/comment-on ids to String.
lampray-content/comment-service/src/main/java/tech/lamprism/lampray/content/comment/persistence/CommentDao.kt Updates DAO generic types to CommentEntity, String and adds userId query.
lampray-content/comment-service/src/main/java/tech/lamprism/lampray/content/comment/CommentDetailsMetadata.java Refactors comment metadata ids to String.
lampray-content/comment-service/src/main/java/tech/lamprism/lampray/content/comment/Comment.java Refactors comment domain entity to DataEntity<String> and uses empty-string root id.
lampray-content/article-service/src/main/java/tech/lamprism/lampray/content/article/service/ArticleService.java Generates article resourceId and updates repository/entity usage to string ids.
lampray-content/article-service/src/main/java/tech/lamprism/lampray/content/article/service/ArticleContentProvider.kt Switches persistence conversion helper from toDo() to toEntity().
lampray-content/article-service/src/main/java/tech/lamprism/lampray/content/article/persistence/ArticleRepository.kt Switches repository identity type to String and updates specs accordingly.
lampray-content/article-service/src/main/java/tech/lamprism/lampray/content/article/persistence/ArticleEntity.kt Refactors article persistence to use resource_id as JPA identifier and fixes create_time column mapping.
lampray-content/article-service/src/main/java/tech/lamprism/lampray/content/article/persistence/ArticleDao.kt Updates DAO generic types to ArticleEntity, String.
lampray-content/article-service/src/main/java/tech/lamprism/lampray/content/article/Article.java Refactors article domain entity to DataEntity<String> with explicit resourceId.
Comments suppressed due to low confidence (1)

lampray-content/review-service/src/main/java/tech/lamprism/lampray/content/review/feedback/ReviewCategory.kt:42

  • This enum removal drops previously available categories (e.g., CONTENT_QUALITY, GRAMMAR, FORMAT, TECHNICAL). That’s a breaking API/serialization change and appears unrelated to the resourceId migration described in the PR. If intended, it should be called out explicitly in the PR description/release notes or moved to a dedicated PR to avoid surprising downstream consumers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 102 out of 103 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

lampray-content/review-service/src/main/java/tech/lamprism/lampray/content/review/feedback/ReviewCategory.kt:42

  • This change removes several ReviewCategory enum values (e.g., CONTENT_QUALITY/GRAMMAR/FORMAT/TECHNICAL). This is a breaking API/behavior change unrelated to the PR’s stated focus on identifier migration and persistence refactors; please confirm it’s intentional and update the PR description/changelog accordingly (or keep the previous values for compatibility).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gradlew
Comment thread gradlew
Comment thread gradlew.bat
@roll-w
roll-w merged commit 4e3c13d into master Apr 5, 2026
1 check passed
@roll-w
roll-w deleted the refactor/new-id branch April 5, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants