-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,400 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package cn.har01d.alist_tvbox.domain; | ||
|
||
public enum TaskResult { | ||
OK, | ||
FAILED, | ||
CANCELLED, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package cn.har01d.alist_tvbox.domain; | ||
|
||
public enum TaskStatus { | ||
READY, | ||
RUNNING, | ||
COMPLETED | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package cn.har01d.alist_tvbox.domain; | ||
|
||
public enum TaskType { | ||
INDEX | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/cn/har01d/alist_tvbox/dto/GenerateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package cn.har01d.alist_tvbox.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class GenerateRequest { | ||
private Integer siteId; | ||
private String path; | ||
private boolean includeSub; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cn.har01d.alist_tvbox.dto; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
@Data | ||
public class IndexRequest { | ||
private Integer siteId; | ||
private String indexName = "index"; | ||
private boolean excludeExternal; | ||
private boolean incremental; | ||
private boolean compress; | ||
private int maxDepth = 10; | ||
private int sleep = 2000; | ||
private Set<String> paths = new HashSet<>(); | ||
private Set<String> stopWords = new HashSet<>(); | ||
private Set<String> excludes = new HashSet<>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cn.har01d.alist_tvbox.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class IndexResponse { | ||
private final Integer taskId; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/cn/har01d/alist_tvbox/dto/IndexTemplateDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package cn.har01d.alist_tvbox.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class IndexTemplateDto { | ||
private Integer siteId; | ||
private String name; | ||
private String data; | ||
private int sleep = 2000; | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/cn/har01d/alist_tvbox/entity/IndexTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package cn.har01d.alist_tvbox.entity; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import org.hibernate.Hibernate; | ||
|
||
import javax.persistence.*; | ||
import java.time.Instant; | ||
import java.util.Objects; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
@RequiredArgsConstructor | ||
@Entity | ||
@TableGenerator(name = "tableGenerator", table = "id_generator", pkColumnName = "entity_name", valueColumnName = "next_id", allocationSize = 1) | ||
public class IndexTemplate { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.TABLE, generator = "tableGenerator") | ||
private Integer id; | ||
private Integer siteId; | ||
private String name; | ||
@Column(columnDefinition = "TEXT") | ||
private String data; | ||
private int sleep; | ||
private Instant createdTime; | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; | ||
IndexTemplate that = (IndexTemplate) o; | ||
return id != null && Objects.equals(id, that.id); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return getClass().hashCode(); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/cn/har01d/alist_tvbox/entity/IndexTemplateRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package cn.har01d.alist_tvbox.entity; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface IndexTemplateRepository extends JpaRepository<IndexTemplate, Integer> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package cn.har01d.alist_tvbox.entity; | ||
|
||
import cn.har01d.alist_tvbox.domain.TaskResult; | ||
import cn.har01d.alist_tvbox.domain.TaskStatus; | ||
import cn.har01d.alist_tvbox.domain.TaskType; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import org.hibernate.Hibernate; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.TableGenerator; | ||
import java.time.Instant; | ||
import java.util.Objects; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
@RequiredArgsConstructor | ||
@Entity | ||
@TableGenerator(name = "tableGenerator", table = "id_generator", pkColumnName = "entity_name", valueColumnName = "next_id", allocationSize = 1) | ||
public class Task { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.TABLE, generator = "tableGenerator") | ||
private Integer id; | ||
private String name; | ||
private TaskType type; | ||
private TaskStatus status = TaskStatus.READY; | ||
private TaskResult result; | ||
private String data; | ||
private String summary; | ||
private String error; | ||
private Instant createdTime; | ||
private Instant startTime; | ||
private Instant updatedTime; | ||
private Instant endTime; | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; | ||
Task task = (Task) o; | ||
return id != null && Objects.equals(id, task.id); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return getClass().hashCode(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/cn/har01d/alist_tvbox/entity/TaskRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package cn.har01d.alist_tvbox.entity; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.time.Instant; | ||
|
||
public interface TaskRepository extends JpaRepository<Task, Integer> { | ||
long deleteAllByCreatedTimeBefore(Instant time); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.