feat: persistent memories (#15953)
feat: memories refactor chore: use heart as favorite icon fix: linting
This commit is contained in:
@@ -5,7 +5,7 @@ import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
|
||||
import { AssetEntity } from 'src/entities/asset.entity';
|
||||
import { MemoryType } from 'src/enum';
|
||||
import { MemoryItem } from 'src/types';
|
||||
import { ValidateBoolean, ValidateDate, ValidateUUID } from 'src/validation';
|
||||
import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from 'src/validation';
|
||||
|
||||
class MemoryBaseDto {
|
||||
@ValidateBoolean({ optional: true })
|
||||
@@ -15,6 +15,22 @@ class MemoryBaseDto {
|
||||
seenAt?: Date;
|
||||
}
|
||||
|
||||
export class MemorySearchDto {
|
||||
@Optional()
|
||||
@IsEnum(MemoryType)
|
||||
@ApiProperty({ enum: MemoryType, enumName: 'MemoryType' })
|
||||
type?: MemoryType;
|
||||
|
||||
@ValidateDate({ optional: true })
|
||||
for?: Date;
|
||||
|
||||
@ValidateBoolean({ optional: true })
|
||||
isTrashed?: boolean;
|
||||
|
||||
@ValidateBoolean({ optional: true })
|
||||
isSaved?: boolean;
|
||||
}
|
||||
|
||||
class OnThisDayDto {
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@@ -62,6 +78,8 @@ export class MemoryResponseDto {
|
||||
deletedAt?: Date;
|
||||
memoryAt!: Date;
|
||||
seenAt?: Date;
|
||||
showAt?: Date;
|
||||
hideAt?: Date;
|
||||
ownerId!: string;
|
||||
@ApiProperty({ enumName: 'MemoryType', enum: MemoryType })
|
||||
type!: MemoryType;
|
||||
@@ -78,6 +96,8 @@ export const mapMemory = (entity: MemoryItem): MemoryResponseDto => {
|
||||
deletedAt: entity.deletedAt ?? undefined,
|
||||
memoryAt: entity.memoryAt,
|
||||
seenAt: entity.seenAt ?? undefined,
|
||||
showAt: entity.showAt ?? undefined,
|
||||
hideAt: entity.hideAt ?? undefined,
|
||||
ownerId: entity.ownerId,
|
||||
type: entity.type as MemoryType,
|
||||
data: entity.data as unknown as MemoryData,
|
||||
|
||||
Reference in New Issue
Block a user