mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(mobile)!: batched full/initial sync (#4840)
* feat(mobile): batched full/initial sync * use OptionalBetween * skip/take as integer --------- Co-authored-by: Fynn Petersen-Frey <zoodyy@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
26fd9d7e5f
commit
21f2d3058a
10 changed files with 189 additions and 63 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import { AssetCreate } from '@app/domain';
|
||||
import { AssetEntity } from '@app/infra/entities';
|
||||
import OptionalBetween from '@app/infra/utils/optional-between.util';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { MoreThan } from 'typeorm';
|
||||
import { In } from 'typeorm/find-options/operator/In';
|
||||
import { Repository } from 'typeorm/repository/Repository';
|
||||
import { AssetSearchDto } from './dto/asset-search.dto';
|
||||
|
|
@ -129,7 +129,7 @@ export class AssetRepository implements IAssetRepository {
|
|||
isVisible: true,
|
||||
isFavorite: dto.isFavorite,
|
||||
isArchived: dto.isArchived,
|
||||
updatedAt: dto.updatedAfter ? MoreThan(dto.updatedAfter) : undefined,
|
||||
updatedAt: OptionalBetween(dto.updatedAfter, dto.updatedBefore),
|
||||
},
|
||||
relations: {
|
||||
exifInfo: true,
|
||||
|
|
@ -137,6 +137,7 @@ export class AssetRepository implements IAssetRepository {
|
|||
stack: true,
|
||||
},
|
||||
skip: dto.skip || 0,
|
||||
take: dto.take,
|
||||
order: {
|
||||
fileCreatedAt: 'DESC',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Optional, toBoolean } from '@app/domain';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsBoolean, IsDate, IsNotEmpty, IsNumber, IsUUID } from 'class-validator';
|
||||
import { IsBoolean, IsDate, IsInt, IsNotEmpty, IsUUID } from 'class-validator';
|
||||
|
||||
export class AssetSearchDto {
|
||||
@Optional()
|
||||
|
|
@ -17,9 +17,17 @@ export class AssetSearchDto {
|
|||
isArchived?: boolean;
|
||||
|
||||
@Optional()
|
||||
@IsNumber()
|
||||
@IsInt()
|
||||
@Type(() => Number)
|
||||
@ApiProperty({ type: 'integer' })
|
||||
skip?: number;
|
||||
|
||||
@Optional()
|
||||
@IsInt()
|
||||
@Type(() => Number)
|
||||
@ApiProperty({ type: 'integer' })
|
||||
take?: number;
|
||||
|
||||
@Optional()
|
||||
@IsUUID('4')
|
||||
@ApiProperty({ format: 'uuid' })
|
||||
|
|
@ -29,4 +37,9 @@ export class AssetSearchDto {
|
|||
@IsDate()
|
||||
@Type(() => Date)
|
||||
updatedAfter?: Date;
|
||||
|
||||
@Optional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
updatedBefore?: Date;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue