New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server, web): album orders #7819
Conversation
Deploying with Cloudflare Pages
|
988b052
to
1162336
Compare
1162336
to
1ca9b43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have other existing query params, etc. We should use consistent naming here as well, not ascendingOrder. I think an enum would make more sense probably.
Something like this ? enum Order {
ASCENDING = 'ascending',
DESCENDING = 'descending',
} |
b43110e
to
356a512
Compare
@@ -23,6 +23,8 @@ export class AlbumResponseDto { | |||
startDate?: Date; | |||
endDate?: Date; | |||
isActivityEnabled!: boolean; | |||
@ApiProperty({ enumName: 'AssetOrder', enum: AssetOrder }) | |||
order!: AssetOrder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shenlong-tanwen will this new property break the mobile app? Do we need to make it order?: AssetOrder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure it will break the mobile app because the SDK will check for this property and it will be null from previous version, so the users will not see any albums
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it optional then to avoid the breaking change. We can change it back in the future after a few releases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shenlong-tanwen will this new property break the mobile app? Do we need to make it
order?: AssetOrder
?
Yes. The mobile app will not sync albums with older server versions. Making it optional would be best.
356a512
to
be1c39e
Compare
70c2261
to
7744fab
Compare
@@ -598,7 +598,7 @@ export class AssetRepository implements IAssetRepository { | |||
.select(`COUNT(asset.id)::int`, 'count') | |||
.addSelect(truncated, 'timeBucket') | |||
.groupBy(truncated) | |||
.orderBy(truncated, 'DESC') | |||
.orderBy(truncated, options.order === AssetOrder.ASC ? 'ASC' : 'DESC') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just do options.order.toUpperCase()
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know about that. I don't like the idea of mixing SQL syntax and enum values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm ok that's fair. Coupling those would result in the query breaking in case we were to ever rename the enum value. That's actually bad, true!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As soon as we add new values to this enum, we'll have to update that part too and I don't know if typescript / typeorm can alert it. It will definitely be a disaster 😆
Hello, thank you for the PR! I just ran some tests, and the order of the assets in the album doesn't seem to change. Can you double-check? |
Can you try with |
@martabal It works now, sorry about my glitchy system |
… feat/album-orders
Ok, it should be fixed |
It would be nice to have Immich-wide or user-wide configuration for default album sorting. I personally prefer "oldest first" order for most of story-like albums, however timelapse albums looks better with "newest first" order. |
User-wide makes sense. You probably can open a FR for that |
Created... #8068 |
This feature is awesome, and I was waiting for it for a long time! Is this a bug or desired behavior ? |
This is definitely a missing feature. We prefer to add features piece by piece, it's easier to correct bugs and get user feedback. |
What's changed
This PR adds the ability to see album assets in ascending/descending order
Screenshots
2024-03-10.16-41-20.mp4