-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(web): tag renaming #17902
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(web): tag renaming #17902
Conversation
ab35dcf to
71b4444
Compare
…tag closures to efficiently query for updated tag descendants
|
Hello, can you help fix the failed checks? You will need to run |
jrasm91
left a comment
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.
This looks quite complicated and I'm not sure this is the direction we want to go. I think the algorithm for keeping the closure table and the tag table in sync may be incorrect. I'm on vacation now so will have to revisit this later unless someone else picks it up.
|
|
||
| export async function up(db: Kysely<any>): Promise<void> { | ||
| const tags = await db.selectFrom('tags').select(columns.tag).execute(); | ||
| return db.transaction().execute(async (tx) => { |
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 write migrations with raw SQL not the query builder. Please take a look at other migrations. This is more portable in our opinion.
| this.logger.setContext(TagRepository.name); | ||
| } | ||
|
|
||
| // #region tags |
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.
Remove this comment
| // #region tags | ||
| @GenerateSql({ params: [DummyValue.UUID] }) | ||
| get(id: string) { | ||
| getOne(id: string) { |
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.
Rename this back to get
| async create(tag: Insertable<Tags>) { | ||
| let createdTag: Selectable<Tags>; | ||
| await this.db.transaction().execute(async (tx) => { | ||
| createdTag = await tx.insertInto('tags').values(tag).returningAll().executeTakeFirstOrThrow(); |
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.
You can just return the value and assign it to the return of the transaction
| return this.db.selectFrom('tags').select(columns.tag).where('id', '=', id).executeTakeFirst(); | ||
| } | ||
|
|
||
| @GenerateSql({ params: [DummyValue.UUID] }) |
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.
This is wrong as the first param is a list
|
Hey @benjamonnguyen would you be able to address jrasm's comments and also rebase this PR on main? |
This comment has been minimized.
This comment has been minimized.
|
Close as stale, feel free to reopen when you decide to pick it up |
Description
Implement repository and service level changes to enable updating tag value with logic to propagate update to all descendants.
Add option to update tag name on web.
Add tags_closure logic to TagRepository.create() and add data fix migration script to cover previous gap.
Disallow slashes in tag names in tag create and update calls
How Has This Been Tested?
BadRequest
OK





Checklist:
src/services/uses repositories implementations for database calls, filesystem operations, etc.src/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)