Skip to content

[PB-6412] feat: added photos backups as folders#1069

Open
apsantiso wants to merge 4 commits into
masterfrom
feat/add-photos-backups-as-folders
Open

[PB-6412] feat: added photos backups as folders#1069
apsantiso wants to merge 4 commits into
masterfrom
feat/add-photos-backups-as-folders

Conversation

@apsantiso
Copy link
Copy Markdown
Collaborator

@apsantiso apsantiso commented May 27, 2026

Added photos backups. The idea is to follow the same principles as deviceAsFolder.

I wanted to avoid creating a new field in the users table, but as we do not have other ways to save buckets (for the time being) and to introduce this without too much changes, it is more straightforward to just add the bucket to that table like we do with backups.

Changes

  • Added migration for photos_bucket in users table
  • Added migration for indexing bucket again
  • Added photos backup creation endpoint
  • Added photos backup modification endpoint
  • Added photos backup listing endpoint
  • Added photos backup get endpoint

@apsantiso apsantiso force-pushed the feat/add-photos-backups-as-folders branch from 7fd95f7 to 21fc5ae Compare May 27, 2026 13:36
@apsantiso apsantiso changed the title [_] feat: added photos backups as folders [PB-6412] feat: added photos backups as folders May 27, 2026
@apsantiso apsantiso force-pushed the feat/add-photos-backups-as-folders branch from 21fc5ae to 6fd0d75 Compare May 27, 2026 13:49
@apsantiso apsantiso force-pushed the feat/add-photos-backups-as-folders branch from d3bf58d to 318ebb6 Compare May 27, 2026 14:51
@apsantiso apsantiso force-pushed the feat/add-photos-backups-as-folders branch from 318ebb6 to 7de032c Compare May 27, 2026 14:52
@apsantiso apsantiso force-pushed the feat/add-photos-backups-as-folders branch from 7de032c to a0ee7ce Compare May 27, 2026 14:55
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.query(
`CREATE INDEX CONCURRENTLY IF NOT EXISTS bucket_index ON folders (bucket) WHERE deleted = false AND removed = false`,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The index was removed from prod, but we look by bucket when fetching any device as folder.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does the device have parent folder ? If not, add the parent_id NULL condition to the index, so we avoid indexing the whole folders-existing part just for a minority of records that act as 'devices'

@apsantiso apsantiso self-assigned this May 27, 2026
@apsantiso apsantiso added migration-required A migration is included in the PR enhancement New feature or request labels May 27, 2026
Comment thread migrations/20260527141812-add-photos-bucket-to-users.js
@apsantiso apsantiso marked this pull request as ready for review May 27, 2026 14:59
@apsantiso apsantiso requested a review from jzunigax2 as a code owner May 27, 2026 14:59
@apsantiso apsantiso requested a review from sg-gs May 27, 2026 14:59
Comment thread src/modules/backups/backup.controller.ts Outdated
@apsantiso apsantiso force-pushed the feat/add-photos-backups-as-folders branch from 18a3c75 to b2a2460 Compare May 28, 2026 10:24
@apsantiso apsantiso deployed to development May 28, 2026 10:24 — with GitHub Actions Active
@sonarqubecloud
Copy link
Copy Markdown

@apsantiso apsantiso requested a review from sg-gs May 28, 2026 10:58
Copy link
Copy Markdown
Member

@sg-gs sg-gs left a comment

Choose a reason for hiding this comment

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

Running migration on Monday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request migration-required A migration is included in the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants