Compare commits
2
Commits
NCP-4
..
11b74e046d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11b74e046d | ||
|
|
149bd961e2 |
@@ -1,17 +0,0 @@
|
|||||||
name: Test Workflow
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Print environment variables
|
|
||||||
run: |
|
|
||||||
echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
|
|
||||||
echo "GITHUB_SHA: $GITHUB_SHA"
|
|
||||||
echo "GITHUB_REF: $GITHUB_REF"
|
|
||||||
echo "GITHUB_ACTOR: $GITHUB_ACTOR"
|
|
||||||
echo "PATH: $PATH"
|
|
||||||
+1
-1
@@ -44,7 +44,7 @@ services:
|
|||||||
alloy:
|
alloy:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
environment:
|
environment:
|
||||||
GF_AUTH_ANONYMOUS_ENABLED: "true"
|
GF_AUTH_ANONYMOUS_ENABLED: true
|
||||||
GF_SECURITY_ADMIN_USER: admin
|
GF_SECURITY_ADMIN_USER: admin
|
||||||
GF_SECURITY_ADMIN_PASSWORD: admin
|
GF_SECURITY_ADMIN_PASSWORD: admin
|
||||||
GF_METRICS_ENABLED: "true"
|
GF_METRICS_ENABLED: "true"
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package ru.soune.no_copy.controller;
|
|
||||||
|
|
||||||
import org.apache.coyote.Response;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api")
|
|
||||||
public class HealtCheckController {
|
|
||||||
|
|
||||||
@GetMapping("/healt")
|
|
||||||
public HttpStatus healtCheck() {
|
|
||||||
return HttpStatus.OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package ru.soune.no_copy.dto;
|
||||||
|
|
||||||
|
import ru.soune.no_copy.entity.ContentStatus;
|
||||||
|
import ru.soune.no_copy.entity.FileType;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
public record UserContentResponse(
|
||||||
|
Long id,
|
||||||
|
String filename,
|
||||||
|
String originalFilename,
|
||||||
|
FileType fileType,
|
||||||
|
long fileSize,
|
||||||
|
String filePath,
|
||||||
|
ContentStatus status,
|
||||||
|
LocalDateTime uploadDate
|
||||||
|
) {}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package ru.soune.no_copy.entity;
|
||||||
|
|
||||||
|
public enum ContentStatus {
|
||||||
|
PROCESSING, COMPLETED, ERROR
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package ru.soune.no_copy.entity;
|
||||||
|
|
||||||
|
public enum FileType {
|
||||||
|
PHOTO, DOCUMENT, AUDIO, VIDEO
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package ru.soune.no_copy.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Getter @Setter
|
||||||
|
@Table(name = "user_content",
|
||||||
|
indexes = {
|
||||||
|
@Index(name = "idx_user_id", columnList = "user_id"),
|
||||||
|
@Index(name = "idx_file_type", columnList = "file_type"),
|
||||||
|
@Index(name = "idx_upload_date", columnList = "upload_date")
|
||||||
|
})
|
||||||
|
public class UserContent {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "user_id", nullable = false,
|
||||||
|
foreignKey = @ForeignKey(name = "fk_usercontent_user"))
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String filename;
|
||||||
|
|
||||||
|
@Column(name = "original_filename", nullable = false)
|
||||||
|
private String originalFilename;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "file_type", nullable = false, length = 16)
|
||||||
|
private FileType fileType;
|
||||||
|
|
||||||
|
@Column(name = "file_extension", length = 16)
|
||||||
|
private String fileExtension;
|
||||||
|
|
||||||
|
@Column(name = "file_size", nullable = false)
|
||||||
|
private Long fileSize;
|
||||||
|
|
||||||
|
@Column(name = "file_path", columnDefinition = "TEXT", nullable = false)
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
@Column(name = "protection_level")
|
||||||
|
private Integer protectionLevel;
|
||||||
|
|
||||||
|
@Column(name = "geometric_resistant")
|
||||||
|
private Boolean geometricResistant = false;
|
||||||
|
|
||||||
|
@Column(name = "watermark_applied")
|
||||||
|
private Boolean watermarkApplied = false;
|
||||||
|
|
||||||
|
@Column(name = "protection_hash", length = 64)
|
||||||
|
private String protectionHash;
|
||||||
|
|
||||||
|
@Column(name = "watermark_id", length = 50)
|
||||||
|
private String watermarkId;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(length = 16)
|
||||||
|
private ContentStatus status = ContentStatus.PROCESSING;
|
||||||
|
|
||||||
|
@CreationTimestamp
|
||||||
|
@Column(name = "upload_date", nullable = false, updatable = false)
|
||||||
|
private LocalDateTime uploadDate;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package ru.soune.no_copy.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import ru.soune.no_copy.entity.FileType;
|
||||||
|
import ru.soune.no_copy.entity.UserContent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface UserContentRepository extends JpaRepository<UserContent, Long> {
|
||||||
|
List<UserContent> findByUserIdOrderByUploadDateDesc(Long userId);
|
||||||
|
|
||||||
|
List<UserContent> findByUserIdAndFileTypeOrderByUploadDateDesc(
|
||||||
|
Long userId, FileType type, Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
long countByUserIdAndFileType(Long userId, FileType type);
|
||||||
|
|
||||||
|
long countByUserId(Long userId);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user