Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2023-2025 RollW
# Copyright (C) 2023-2026 RollW
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
10 changes: 5 additions & 5 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 RollW
* Copyright (C) 2023-2026 RollW
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@
import space.lingu.NonNull;
import space.lingu.Nullable;
import tech.lamprism.lampray.DataEntity;
import tech.lamprism.lampray.LongEntityBuilder;
import tech.lamprism.lampray.EntityBuilder;
import tech.lamprism.lampray.content.ContentDetails;
import tech.lamprism.lampray.content.ContentDetailsMetadata;
import tech.lamprism.lampray.content.ContentType;
Expand All @@ -30,18 +30,20 @@
/**
* @author RollW
*/
public class Article implements DataEntity<Long>, ContentDetails {
public class Article implements DataEntity<String>, ContentDetails {
private final Long id;
private final String resourceId;
private final long userId;
private final String title;
private final String cover;
private final StructuralText content;
private final OffsetDateTime createTime;
private final OffsetDateTime updateTime;

public Article(Long id, long userId, String title, String cover,
public Article(Long id, String resourceId, long userId, String title, String cover,
StructuralText content, OffsetDateTime createTime, OffsetDateTime updateTime) {
this.id = id;
this.resourceId = resourceId;
this.userId = userId;
this.title = title;
this.cover = cover;
Expand All @@ -55,14 +57,14 @@ public Long getId() {
}

@Override
public Long getEntityId() {
return id;
public String getEntityId() {
return resourceId;
}

@Override
@NonNull
public Long getResourceId() {
return DataEntity.super.getResourceId();
public String getResourceId() {
return resourceId;
}

@Override
Expand Down Expand Up @@ -103,8 +105,8 @@ public String getCover() {
return cover;
}

public Article fork(Long id) {
return new Article(id, userId, title, cover,
public Article fork(Long id, String resourceId) {
return new Article(id, resourceId, userId, title, cover,
content, createTime, updateTime
);
}
Expand All @@ -118,7 +120,7 @@ public static Builder builder() {
}

@Override
public long getContentId() {
public String getContentId() {
return getEntityId();
}

Expand All @@ -128,8 +130,9 @@ public ContentType getContentType() {
return ContentType.ARTICLE;
}

public final static class Builder implements LongEntityBuilder<Article> {
public final static class Builder implements EntityBuilder<Article, String> {
private Long id;
private String resourceId;
private long userId;
private String title;
private String cover;
Expand All @@ -143,6 +146,7 @@ public Builder() {

public Builder(Article article) {
this.id = article.id;
this.resourceId = article.resourceId;
this.userId = article.userId;
this.title = article.title;
this.cover = article.cover;
Expand All @@ -152,11 +156,20 @@ public Builder(Article article) {
}

@Override
public Builder setEntityId(Long id) {
public Builder setEntityId(String id) {
return setResourceId(id);
}

public Builder setId(Long id) {
this.id = id;
return this;
}

public Builder setResourceId(String resourceId) {
this.resourceId = resourceId;
return this;
}

public Builder setUserId(long userId) {
this.userId = userId;
return this;
Expand Down Expand Up @@ -189,7 +202,7 @@ public Builder setCover(String cover) {

@Override
public Article build() {
return new Article(id, userId, title, cover, content,
return new Article(id, resourceId, userId, title, cover, content,
createTime, updateTime);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 RollW
* Copyright (C) 2023-2026 RollW
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,16 +16,11 @@

package tech.lamprism.lampray.content.article.persistence

import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param
import tech.lamprism.lampray.common.data.CommonDao
import tech.lamprism.lampray.common.data.Dao

/**
* @author RollW
*/
@Dao
interface ArticleDao : CommonDao<ArticleDo, Long> {
@Query("FROM ArticleDo a WHERE a.userId = :userId")
fun findAllByUserId(@Param("userId") userId: Long): List<ArticleDo>
}
interface ArticleDao : CommonDao<ArticleEntity, String>
Loading
Loading