Compare commits

..

6 Commits

Author SHA1 Message Date
standardci
b9032f3012 chore(release): publish new version
- @standardnotes/syncing-server@1.26.3
2022-12-15 06:31:07 +00:00
Karol Sójko
ce53c459e6 fix(syncing-server): select fields in query for revisions 2022-12-15 07:28:43 +01:00
standardci
6df42fb0d5 chore(release): publish new version
- @standardnotes/syncing-server@1.26.2
2022-12-14 19:08:28 +00:00
Karol Sójko
1e2b496f4f fix(syncing-server): revisions procedure logs 2022-12-14 20:06:07 +01:00
standardci
528c1b0d57 chore(release): publish new version
- @standardnotes/syncing-server@1.26.1
2022-12-14 18:58:11 +00:00
Karol Sójko
22fba8ba80 fix(syncing-server): revisions procedure logs 2022-12-14 19:56:17 +01:00
4 changed files with 31 additions and 9 deletions

View File

@@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.26.3](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.26.2...@standardnotes/syncing-server@1.26.3) (2022-12-15)
### Bug Fixes
* **syncing-server:** select fields in query for revisions ([ce53c45](https://github.com/standardnotes/syncing-server-js/commit/ce53c459e6ad0d469fcd0ebd7bf4caeb0e1d9c9c))
## [1.26.2](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.26.1...@standardnotes/syncing-server@1.26.2) (2022-12-14)
### Bug Fixes
* **syncing-server:** revisions procedure logs ([1e2b496](https://github.com/standardnotes/syncing-server-js/commit/1e2b496f4f87fd49ae8fba8ed9b76d3b6a2c31fa))
## [1.26.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.26.0...@standardnotes/syncing-server@1.26.1) (2022-12-14)
### Bug Fixes
* **syncing-server:** revisions procedure logs ([22fba8b](https://github.com/standardnotes/syncing-server-js/commit/22fba8ba806115b0f4bb4b083ae8595a3f0010b0))
# [1.26.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.25.6...@standardnotes/syncing-server@1.26.0) (2022-12-14)
### Features

View File

@@ -27,7 +27,7 @@ const fixRevisionsOwnership = async (
const itemsCount = await itemRepository.countAll({
createdBetween: [createdAfter, createdBefore],
selectFields: ['user_uuid', 'uuid'],
selectFields: ['uuid', 'userUuid'],
contentType: [ContentType.Note, ContentType.File],
sortOrder: 'ASC',
sortBy: 'uuid',
@@ -36,17 +36,20 @@ const fixRevisionsOwnership = async (
logger.info(`There are ${itemsCount} items between ${createdAfter.toISOString()} and ${createdBefore.toISOString()}`)
const limit = 500
let page = 1
const amountOfPages = Math.ceil(itemsCount / limit)
const tenPercentOfPages = Math.ceil(amountOfPages / 10)
for (page; page <= amountOfPages; page++) {
let itemsProcessedCounter = 0
let itemsSkippedCounter = 0
for (let page = 1; page <= amountOfPages; page++) {
if (page % tenPercentOfPages === 0) {
logger.info(`Processing page ${page} of ${amountOfPages}`)
logger.info(
`Processing page ${page} of ${amountOfPages} items between ${createdAfter.toISOString()} and ${createdBefore.toISOString()}. Processed successfully ${itemsProcessedCounter} items. Skipped ${itemsSkippedCounter} items.`,
)
}
const items = await itemRepository.findAll({
createdBetween: [createdAfter, createdBefore],
selectFields: ['user_uuid', 'uuid'],
selectFields: ['uuid', 'userUuid'],
contentType: [ContentType.Note, ContentType.File],
offset: (page - 1) * limit,
limit,
@@ -56,8 +59,7 @@ const fixRevisionsOwnership = async (
for (const item of items) {
if (!item.userUuid || !item.uuid) {
logger.error('Could not process item %O', item)
itemsSkippedCounter++
continue
}
@@ -67,6 +69,8 @@ const fixRevisionsOwnership = async (
itemUuid: item.uuid,
}),
)
itemsProcessedCounter++
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.26.0",
"version": "1.26.3",
"engines": {
"node": ">=18.0.0 <19.0.0"
},

View File

@@ -136,7 +136,7 @@ export class MySQLItemRepository implements ItemRepositoryInterface {
}
if (query.selectFields !== undefined) {
queryBuilder.select(query.selectFields.map((field) => `item.${field}`))
queryBuilder.select(query.selectFields)
}
if (query.userUuid !== undefined) {
queryBuilder.where('item.user_uuid = :userUuid', { userUuid: query.userUuid })