Skip to content

Conversation

@Wingysam
Copy link
Contributor

Description

Exposed the createdAt field in the response for getAssetInfo. This is useful for writing scripts that do something based on when an asset was uploaded. For example, the other day I imported my Google Photos library, and wanted to write a script to tag all of the photos I uploaded that day.

Today, someone on Discord asked for a way to delete recently uploaded assets:

image

How Has This Been Tested?

Uploaded an asset, then looked at the API response and verified that the new field is present:

image

API Changes

The /api/asset endpoint now exposes createdAt.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)


return {
id: entity.id,
createdAt: entity.createdAt,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need some kind of test case to verify that this is present, or is the ts compiler validating it enough?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this it's fine

}

export class AssetResponseDto extends SanitizedAssetResponseDto {
@ApiProperty({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this automatically go to the API docs in CI, or do I need to run something to rebuild the docs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generating the open-api specs (what you did) is all it takes :)

@Wingysam Wingysam changed the title Expose createdAt in getAssetInfo feat: Expose createdAt in getAssetInfo Aug 23, 2025
Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alextran1502 alextran1502 changed the title feat: Expose createdAt in getAssetInfo feat: expose createdAt in getAssetInfo Aug 25, 2025
@alextran1502 alextran1502 merged commit 5fb8d65 into immich-app:main Aug 25, 2025
55 of 57 checks passed
ollioddi pushed a commit to ollioddi/immich that referenced this pull request Aug 27, 2025
* Expose createdAt in getAssetInfo

* Add missing createdAt fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants