feat(server): add originalFileName to SyncAssetV1 (#18767)

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
shenlong 2025-05-30 20:26:35 +05:30 committed by GitHub
parent aebd68e24e
commit b854a3dd47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 14 additions and 0 deletions

Binary file not shown.

View file

@ -13127,6 +13127,9 @@
"nullable": true, "nullable": true,
"type": "string" "type": "string"
}, },
"originalFileName": {
"type": "string"
},
"ownerId": { "ownerId": {
"type": "string" "type": "string"
}, },
@ -13161,6 +13164,7 @@
"id", "id",
"isFavorite", "isFavorite",
"localDateTime", "localDateTime",
"originalFileName",
"ownerId", "ownerId",
"thumbhash", "thumbhash",
"type", "type",

View file

@ -341,6 +341,7 @@ export const columns = {
syncAsset: [ syncAsset: [
'id', 'id',
'ownerId', 'ownerId',
'originalFileName',
'thumbhash', 'thumbhash',
'checksum', 'checksum',
'fileCreatedAt', 'fileCreatedAt',

View file

@ -59,6 +59,7 @@ export class SyncPartnerDeleteV1 {
export class SyncAssetV1 { export class SyncAssetV1 {
id!: string; id!: string;
ownerId!: string; ownerId!: string;
originalFileName!: string;
thumbhash!: string | null; thumbhash!: string | null;
checksum!: string; checksum!: string;
fileCreatedAt!: Date | null; fileCreatedAt!: Date | null;

View file

@ -76,6 +76,7 @@ order by
select select
"id", "id",
"ownerId", "ownerId",
"originalFileName",
"thumbhash", "thumbhash",
"checksum", "checksum",
"fileCreatedAt", "fileCreatedAt",
@ -98,6 +99,7 @@ order by
select select
"id", "id",
"ownerId", "ownerId",
"originalFileName",
"thumbhash", "thumbhash",
"checksum", "checksum",
"fileCreatedAt", "fileCreatedAt",

View file

@ -23,12 +23,14 @@ describe.concurrent(SyncEntityType.AssetV1, () => {
it('should detect and sync the first asset', async () => { it('should detect and sync the first asset', async () => {
const { auth, sut, getRepository, testSync } = await setup(); const { auth, sut, getRepository, testSync } = await setup();
const originalFileName = 'firstAsset';
const checksum = '1115vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA='; const checksum = '1115vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA=';
const thumbhash = '2225vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA='; const thumbhash = '2225vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA=';
const date = new Date().toISOString(); const date = new Date().toISOString();
const assetRepo = getRepository('asset'); const assetRepo = getRepository('asset');
const asset = mediumFactory.assetInsert({ const asset = mediumFactory.assetInsert({
originalFileName,
ownerId: auth.user.id, ownerId: auth.user.id,
checksum: Buffer.from(checksum, 'base64'), checksum: Buffer.from(checksum, 'base64'),
thumbhash: Buffer.from(thumbhash, 'base64'), thumbhash: Buffer.from(thumbhash, 'base64'),
@ -48,6 +50,7 @@ describe.concurrent(SyncEntityType.AssetV1, () => {
ack: expect.any(String), ack: expect.any(String),
data: { data: {
id: asset.id, id: asset.id,
originalFileName,
ownerId: asset.ownerId, ownerId: asset.ownerId,
thumbhash, thumbhash,
checksum, checksum,

View file

@ -23,6 +23,7 @@ describe.concurrent(SyncRequestType.PartnerAssetsV1, () => {
it('should detect and sync the first partner asset', async () => { it('should detect and sync the first partner asset', async () => {
const { auth, sut, getRepository, testSync } = await setup(); const { auth, sut, getRepository, testSync } = await setup();
const originalFileName = 'firstPartnerAsset';
const checksum = '1115vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA='; const checksum = '1115vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA=';
const thumbhash = '2225vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA='; const thumbhash = '2225vHcVkZzNp3Q9G+FEA0nu6zUbGb4Tj4UOXkN0wRA=';
const date = new Date().toISOString(); const date = new Date().toISOString();
@ -34,6 +35,7 @@ describe.concurrent(SyncRequestType.PartnerAssetsV1, () => {
const assetRepo = getRepository('asset'); const assetRepo = getRepository('asset');
const asset = mediumFactory.assetInsert({ const asset = mediumFactory.assetInsert({
ownerId: user2.id, ownerId: user2.id,
originalFileName,
checksum: Buffer.from(checksum, 'base64'), checksum: Buffer.from(checksum, 'base64'),
thumbhash: Buffer.from(thumbhash, 'base64'), thumbhash: Buffer.from(thumbhash, 'base64'),
fileCreatedAt: date, fileCreatedAt: date,
@ -56,6 +58,7 @@ describe.concurrent(SyncRequestType.PartnerAssetsV1, () => {
data: { data: {
id: asset.id, id: asset.id,
ownerId: asset.ownerId, ownerId: asset.ownerId,
originalFileName,
thumbhash, thumbhash,
checksum, checksum,
deletedAt: null, deletedAt: null,