Skip to content

Develop#18

Merged
Codespilot merged 11 commits into
mainfrom
develop
Jun 2, 2026
Merged

Develop#18
Codespilot merged 11 commits into
mainfrom
develop

Conversation

@Codespilot

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 2, 2026 10:12
@Codespilot Codespilot merged commit 5c51f5b into main Jun 2, 2026

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 significantly expands the bundle module with read APIs (search/count for bundles and bundle items) plus a new BookmarkController aggregating bookmark-typed bundles, adds the supporting query/handler/model/DTO classes, tightens Hibernate config (globally_quoted_identifiers: true) across identity, message, and bundle, normalizes index/table naming on identity entities (and adds indexes to Token/OnetimePassword/Authlog), and adds a multi-section README.

Changes:

  • New bundle read-side: BookmarkController, BundleController search/count endpoints, Bundle{,Item}{List,Count}Query/Handler, BundleListModel, BundleItemListDto, plus BundleApplicationService extensions.
  • Persistence/config tweaks: globally_quoted_identifiers enabled in three modules; identity entity table/index renames (usersuser, idx_* prefix, new indexes on Token/OnetimePassword/Authlog); BundleExtend.itemCountitemsCount; Long.getLong bug fixed to Long.parseLong in BundleCreateCommandHandler.
  • Misc: security rules updated for new GET endpoints; BundleController route base changed /api/bundles/api/bundle and methods renamed to *Async; new MapUtility and Lombok @Data on BundleUpdateCommand; comprehensive README.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
README.md New project README; uses hard-coded absolute paths in commands.
message/src/main/resources/application.yaml Adds globally_quoted_identifiers/multiTenancy/format_sql under hibernate.
identity/src/main/resources/application.yaml Adds globally_quoted_identifiers: true.
identity/src/main/java/.../entity/UserRole.java Renames index to idx_user_role_unique.
identity/src/main/java/.../entity/UserAuthority.java Renames index to idx_user_authority_unique.
identity/src/main/java/.../entity/User.java Renames table usersuser and index names.
identity/src/main/java/.../entity/Token.java Adds idx_token_jti (unique) and idx_token_subject indexes; wildcard import.
identity/src/main/java/.../entity/OnetimePassword.java Adds idx_onetime_password_request_id index; wildcard import.
identity/src/main/java/.../entity/Authlog.java Adds user_id/username indexes; wildcard import.
framework/src/main/java/.../utility/MapUtility.java New tryGet(map, key, consumer) helper.
bundle/src/main/resources/application.yaml Adds globally_quoted_identifiers: true.
bundle/src/main/java/.../persistence/query/BundleListQuery.java New record query with tryGet helper.
bundle/src/main/java/.../persistence/query/BundleItemListQuery.java New record query.
bundle/src/main/java/.../persistence/query/BundleItemCountQuery.java New record query.
bundle/src/main/java/.../persistence/query/BundleCountQuery.java New record query.
bundle/src/main/java/.../persistence/profile/BundleMapProfile.java Adds BundleBundleListModel mapping with extend fields.
bundle/src/main/java/.../persistence/model/BundleListModel.java New read model for bundle list responses.
bundle/src/main/java/.../persistence/model/BundleItemModel.java Adds fields incl. reserved-word order.
bundle/src/main/java/.../persistence/handler/BundleListQueryHandler.java New handler; default branch maps unknown criteria keys directly to JPA equality.
bundle/src/main/java/.../persistence/handler/BundleItemListQueryHandler.java New handler; double query.where and unscoped join.
bundle/src/main/java/.../persistence/handler/BundleItemCountQueryHandler.java New handler; same double where issue.
bundle/src/main/java/.../persistence/handler/BundleCountQueryHandler.java New count handler; same default over-permissive branch.
bundle/src/main/java/.../persistence/entity/BundleExtend.java Renames item_countitems_count.
bundle/src/main/java/.../persistence/entity/Bundle.java Lowercases text columnDefinition.
bundle/src/main/java/.../interfaces/package-info.java Aligns package with file location.
bundle/src/main/java/.../interfaces/controller/BundleController.java Renames base URL, methods to *Async, new /list & /count.
bundle/src/main/java/.../interfaces/controller/BookmarkController.java New controller for /api/bookmark/**.
bundle/src/main/java/.../configure/SecurityConfiguration.java Adds permitAll/authenticated GET rules; ordering makes /my unreachable.
bundle/src/main/java/.../application/implement/BundleApplicationServiceImpl.java Implements new search/count methods; mutates and forwards owned key.
bundle/src/main/java/.../application/handler/BundleCreateCommandHandler.java Fixes Long.getLongLong.parseLong.
bundle/src/main/java/.../application/dto/BundleItemListDto.java New DTO; reserved-word field order.
bundle/src/main/java/.../application/contract/BundleApplicationService.java Adds search/count contract methods + class javadoc.
bundle/src/main/java/.../application/command/BundleUpdateCommand.java Replaces explicit getters/setters with Lombok @Data.

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

Comment on lines +60 to +63
query.where(builder.and(predicates.toArray(new Predicate[0])));
if (!predicates.isEmpty()) {
query.where(builder.or(predicates.toArray(new Predicate[0])));
}
Comment on lines +53 to +56
query.where(builder.and(predicates.toArray(new Predicate[0])));
if (!predicates.isEmpty()) {
query.where(builder.or(predicates.toArray(new Predicate[0])));
}
Comment on lines +35 to +37
auth.requestMatchers(HttpMethod.GET, "/api/bundle/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/bookmark/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/bookmark/my").authenticated()
Comment on lines +42 to +57
message.criteria().forEach((k, v) -> {
switch (k) {
case "ownerId" -> predicates.add(builder.equal(select.get("ownerId"), v));
case "type" -> predicates.add(builder.equal(select.get("type"), v));
case "keyword" -> {
if (v instanceof String keyword) {
Predicate orGroup = builder.or(
builder.like(select.get("name"), "%" + keyword + "%"),
builder.like(select.get("description"), "%" + keyword + "%")
);
predicates.add(orGroup);
}
}
default -> predicates.add(builder.equal(select.get(k), v));
}
});
Comment on lines +35 to +50
message.criteria().forEach((key, value) -> {
switch (key) {
case "ownerId" -> predicates.add(builder.equal(select.get("ownerId"), value));
case "type" -> predicates.add(builder.equal(select.get("type"), value));
case "keyword" -> {
if (value instanceof String keyword) {
Predicate orGroup = builder.or(
builder.like(select.get("name"), "%" + keyword + "%"),
builder.like(select.get("description"), "%" + keyword + "%")
);
predicates.add(orGroup);
}
}
default -> predicates.add(builder.equal(select.get(key), value));
}
});
Comment on lines +12 to +15
@Table(name = "user", indexes = {
@Index(name = "idx_user_idx_username", columnList = "username", unique = true),
@Index(name = "idx_user_idx_email", columnList = "email", unique = true),
@Index(name = "idx_user_idx_phone", columnList = "phone", unique = true)
private String title;
private String description;
private String image;
private int order;
var query = builder.createQuery(BundleItem.class);
var entity = query.from(BundleItem.class);

Join<BundleItem, Bundle> join = entity.join(Bundle.class);
Comment thread README.md
Comment on lines +52 to +85
```bash
cd /Users/rong/Code/Github/Linkyou/server
mvn clean install
```

### 2) 仅运行测试

```bash
cd /Users/rong/Code/Github/Linkyou/server
mvn test
```

### 3) 启动本地依赖(Docker Compose)

```bash
cd /Users/rong/Code/Github/Linkyou/server
docker compose -f docker-compose.yaml up -d
```

### 4) 停止本地依赖

```bash
cd /Users/rong/Code/Github/Linkyou/server
docker compose -f docker-compose.yaml down
```

## 常用模块命令

在根目录执行(示例以 `identity` 模块为例):

```bash
cd /Users/rong/Code/Github/Linkyou/server
mvn -pl identity -am clean package
```
Comment on lines +6 to +12
public class MapUtility {
public static <K, V> void tryGet(Map<K, V> criteria, K key, Consumer<? super V> function) {
if (criteria.containsKey(key)) {
function.accept(criteria.get(key));
}
}
}
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.

2 participants