mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-05-16 11:17:38 +08:00
feat(album): add cover picture functionality to albums and enhance album management API
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Foxel.Models.DataBase;
|
||||
|
||||
@@ -14,5 +15,9 @@ public class Album : BaseModel
|
||||
[Required]
|
||||
public User User { get; set; }
|
||||
|
||||
public int? CoverPictureId { get; set; }
|
||||
[ForeignKey("CoverPictureId")]
|
||||
public Picture? CoverPicture { get; set; }
|
||||
|
||||
public ICollection<Picture>? Pictures { get; set; }
|
||||
}
|
||||
|
||||
16
Models/Request/Album/AlbumCreateRequest.cs
Normal file
16
Models/Request/Album/AlbumCreateRequest.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Foxel.Models.Request.Album
|
||||
{
|
||||
public class AlbumCreateRequest
|
||||
{
|
||||
[Required(ErrorMessage = "相册名称不能为空")]
|
||||
[StringLength(100, ErrorMessage = "相册名称长度不能超过100个字符")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[StringLength(500, ErrorMessage = "相册描述长度不能超过500个字符")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public int? CoverPictureId { get; set; }
|
||||
}
|
||||
}
|
||||
15
Models/Request/Album/AlbumUpdateRequest.cs
Normal file
15
Models/Request/Album/AlbumUpdateRequest.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Foxel.Models.Request.Album
|
||||
{
|
||||
public class AlbumUpdateRequest
|
||||
{
|
||||
[StringLength(100, ErrorMessage = "相册名称长度不能超过100个字符")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[StringLength(500, ErrorMessage = "相册描述长度不能超过500个字符")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public int? CoverPictureId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,7 @@ public record CreateAlbumRequest
|
||||
|
||||
[StringLength(500)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
|
||||
public int? CoverPictureId { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,9 +7,11 @@ public record AlbumResponse
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public int PictureCount { get; set; } = 0;
|
||||
public int UserId { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public string? CoverPicturePath { get; set; }
|
||||
public string? CoverPictureThumbnailPath { get; set; }
|
||||
public int PictureCount { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user