Skip to content

Commit c9f0635

Browse files
shenlong-tanwenalextran1502
authored andcommitted
feat(server): add originalFileName to SyncAssetV1 (immich-app#18767)
Co-authored-by: shenlong-tanwen <[email protected]> Co-authored-by: Alex <[email protected]>
1 parent 1f7bda2 commit c9f0635

File tree

7 files changed

+23
-1
lines changed

7 files changed

+23
-1
lines changed

mobile/openapi/lib/model/sync_asset_v1.dart

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

open-api/immich-openapi-specs.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13127,6 +13127,9 @@
1312713127
"nullable": true,
1312813128
"type": "string"
1312913129
},
13130+
"originalFileName": {
13131+
"type": "string"
13132+
},
1313013133
"ownerId": {
1313113134
"type": "string"
1313213135
},
@@ -13161,6 +13164,7 @@
1316113164
"id",
1316213165
"isFavorite",
1316313166
"localDateTime",
13167+
"originalFileName",
1316413168
"ownerId",
1316513169
"thumbhash",
1316613170
"type",

server/src/database.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ export const columns = {
341341
syncAsset: [
342342
'id',
343343
'ownerId',
344+
'originalFileName',
344345
'thumbhash',
345346
'checksum',
346347
'fileCreatedAt',

server/src/dtos/sync.dto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export class SyncPartnerDeleteV1 {
5959
export class SyncAssetV1 {
6060
id!: string;
6161
ownerId!: string;
62+
originalFileName!: string;
6263
thumbhash!: string | null;
6364
checksum!: string;
6465
fileCreatedAt!: Date | null;

server/src/queries/sync.repository.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ order by
7676
select
7777
"id",
7878
"ownerId",
79+
"originalFileName",
7980
"thumbhash",
8081
"checksum",
8182
"fileCreatedAt",
@@ -98,6 +99,7 @@ order by
9899
select
99100
"id",
100101
"ownerId",
102+
"originalFileName",
101103
"thumbhash",
102104
"checksum",
103105
"fileCreatedAt",

server/test/medium/specs/sync/sync-asset.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ describe.concurrent(SyncEntityType.AssetV1, () => {
2323
it('should detect and sync the first asset', async () => {
2424
const { auth, sut, getRepository, testSync } = await setup();
2525

26+
const originalFileName = 'firstAsset';
2627
const checksum = '1115vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA=';
2728
const thumbhash = '2225vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA=';
2829
const date = new Date().toISOString();
2930

3031
const assetRepo = getRepository('asset');
3132
const asset = mediumFactory.assetInsert({
33+
originalFileName,
3234
ownerId: auth.user.id,
3335
checksum: Buffer.from(checksum, 'base64'),
3436
thumbhash: Buffer.from(thumbhash, 'base64'),
@@ -48,6 +50,7 @@ describe.concurrent(SyncEntityType.AssetV1, () => {
4850
ack: expect.any(String),
4951
data: {
5052
id: asset.id,
53+
originalFileName,
5154
ownerId: asset.ownerId,
5255
thumbhash,
5356
checksum,

server/test/medium/specs/sync/sync-partner-asset.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe.concurrent(SyncRequestType.PartnerAssetsV1, () => {
2323
it('should detect and sync the first partner asset', async () => {
2424
const { auth, sut, getRepository, testSync } = await setup();
2525

26+
const originalFileName = 'firstPartnerAsset';
2627
const checksum = '1115vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA=';
2728
const thumbhash = '2225vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA=';
2829
const date = new Date().toISOString();
@@ -34,6 +35,7 @@ describe.concurrent(SyncRequestType.PartnerAssetsV1, () => {
3435
const assetRepo = getRepository('asset');
3536
const asset = mediumFactory.assetInsert({
3637
ownerId: user2.id,
38+
originalFileName,
3739
checksum: Buffer.from(checksum, 'base64'),
3840
thumbhash: Buffer.from(thumbhash, 'base64'),
3941
fileCreatedAt: date,
@@ -56,6 +58,7 @@ describe.concurrent(SyncRequestType.PartnerAssetsV1, () => {
5658
data: {
5759
id: asset.id,
5860
ownerId: asset.ownerId,
61+
originalFileName,
5962
thumbhash,
6063
checksum,
6164
deletedAt: null,

0 commit comments

Comments
 (0)