Update Go struct field names: BookmannUuid → BookhoardUuid
Complete the rename by updating: - DeviceCatalogs struct field: BookmannUuid → BookhoardUuid (models.go) - Generated queries: Update all references (queries.sql.go) - Local variables: bookmannUUID → bookhoardUUID (kobo.go) - Struct field access: catalog.BookmannUuid → catalog.BookhoardUuid All "bookmann" and "BOOKMANN" references are now eliminated from the codebase. Part of project rename to Bookhoard.
This commit is contained in:
@@ -32,7 +32,7 @@ type DeviceCatalogs struct {
|
|||||||
ID pgtype.UUID `db:"id" json:"id"`
|
ID pgtype.UUID `db:"id" json:"id"`
|
||||||
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
||||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
||||||
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
BookhoardUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
||||||
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
||||||
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
||||||
Available pgtype.Bool `db:"available" json:"available"`
|
Available pgtype.Bool `db:"available" json:"available"`
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ RETURNING id, device_id, media_item_id, bookhoard_uuid, kobo_content_id, content
|
|||||||
type CreateDeviceCatalogParams struct {
|
type CreateDeviceCatalogParams struct {
|
||||||
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
||||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
||||||
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
BookhoardUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
||||||
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
||||||
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
||||||
Available pgtype.Bool `db:"available" json:"available"`
|
Available pgtype.Bool `db:"available" json:"available"`
|
||||||
@@ -356,7 +356,7 @@ func (q *Queries) CreateDeviceCatalog(ctx context.Context, arg CreateDeviceCatal
|
|||||||
row := q.db.QueryRow(ctx, CreateDeviceCatalog,
|
row := q.db.QueryRow(ctx, CreateDeviceCatalog,
|
||||||
arg.DeviceID,
|
arg.DeviceID,
|
||||||
arg.MediaItemID,
|
arg.MediaItemID,
|
||||||
arg.BookmannUuid,
|
arg.BookhoardUuid,
|
||||||
arg.KoboContentID,
|
arg.KoboContentID,
|
||||||
arg.ContentIDType,
|
arg.ContentIDType,
|
||||||
arg.Available,
|
arg.Available,
|
||||||
@@ -368,7 +368,7 @@ func (q *Queries) CreateDeviceCatalog(ctx context.Context, arg CreateDeviceCatal
|
|||||||
&i.ID,
|
&i.ID,
|
||||||
&i.DeviceID,
|
&i.DeviceID,
|
||||||
&i.MediaItemID,
|
&i.MediaItemID,
|
||||||
&i.BookmannUuid,
|
&i.BookhoardUuid,
|
||||||
&i.KoboContentID,
|
&i.KoboContentID,
|
||||||
&i.ContentIDType,
|
&i.ContentIDType,
|
||||||
&i.Available,
|
&i.Available,
|
||||||
@@ -1825,18 +1825,18 @@ SELECT id, device_id, media_item_id, bookhoard_uuid, kobo_content_id, content_id
|
|||||||
|
|
||||||
type GetDeviceCatalogByBookhoardUUIDParams struct {
|
type GetDeviceCatalogByBookhoardUUIDParams struct {
|
||||||
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
||||||
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
BookhoardUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get device catalog by Bookhoard UUID
|
// Get device catalog by Bookhoard UUID
|
||||||
func (q *Queries) GetDeviceCatalogByBookhoardUUID(ctx context.Context, arg GetDeviceCatalogByBookhoardUUIDParams) (DeviceCatalogs, error) {
|
func (q *Queries) GetDeviceCatalogByBookhoardUUID(ctx context.Context, arg GetDeviceCatalogByBookhoardUUIDParams) (DeviceCatalogs, error) {
|
||||||
row := q.db.QueryRow(ctx, GetDeviceCatalogByBookhoardUUID, arg.DeviceID, arg.BookmannUuid)
|
row := q.db.QueryRow(ctx, GetDeviceCatalogByBookhoardUUID, arg.DeviceID, arg.BookhoardUuid)
|
||||||
var i DeviceCatalogs
|
var i DeviceCatalogs
|
||||||
err := row.Scan(
|
err := row.Scan(
|
||||||
&i.ID,
|
&i.ID,
|
||||||
&i.DeviceID,
|
&i.DeviceID,
|
||||||
&i.MediaItemID,
|
&i.MediaItemID,
|
||||||
&i.BookmannUuid,
|
&i.BookhoardUuid,
|
||||||
&i.KoboContentID,
|
&i.KoboContentID,
|
||||||
&i.ContentIDType,
|
&i.ContentIDType,
|
||||||
&i.Available,
|
&i.Available,
|
||||||
@@ -1858,7 +1858,7 @@ func (q *Queries) GetDeviceCatalogByKoboContentId(ctx context.Context, koboConte
|
|||||||
&i.ID,
|
&i.ID,
|
||||||
&i.DeviceID,
|
&i.DeviceID,
|
||||||
&i.MediaItemID,
|
&i.MediaItemID,
|
||||||
&i.BookmannUuid,
|
&i.BookhoardUuid,
|
||||||
&i.KoboContentID,
|
&i.KoboContentID,
|
||||||
&i.ContentIDType,
|
&i.ContentIDType,
|
||||||
&i.Available,
|
&i.Available,
|
||||||
@@ -1880,7 +1880,7 @@ type GetDeviceCatalogEntriesRow struct {
|
|||||||
ID pgtype.UUID `db:"id" json:"id"`
|
ID pgtype.UUID `db:"id" json:"id"`
|
||||||
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
DeviceID pgtype.UUID `db:"device_id" json:"device_id"`
|
||||||
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
MediaItemID pgtype.UUID `db:"media_item_id" json:"media_item_id"`
|
||||||
BookmannUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
BookhoardUuid pgtype.UUID `db:"bookhoard_uuid" json:"bookhoard_uuid"`
|
||||||
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
KoboContentID string `db:"kobo_content_id" json:"kobo_content_id"`
|
||||||
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
ContentIDType pgtype.Text `db:"content_id_type" json:"content_id_type"`
|
||||||
Available pgtype.Bool `db:"available" json:"available"`
|
Available pgtype.Bool `db:"available" json:"available"`
|
||||||
@@ -1904,7 +1904,7 @@ func (q *Queries) GetDeviceCatalogEntries(ctx context.Context, deviceID pgtype.U
|
|||||||
&i.ID,
|
&i.ID,
|
||||||
&i.DeviceID,
|
&i.DeviceID,
|
||||||
&i.MediaItemID,
|
&i.MediaItemID,
|
||||||
&i.BookmannUuid,
|
&i.BookhoardUuid,
|
||||||
&i.KoboContentID,
|
&i.KoboContentID,
|
||||||
&i.ContentIDType,
|
&i.ContentIDType,
|
||||||
&i.Available,
|
&i.Available,
|
||||||
|
|||||||
+27
-27
@@ -32,7 +32,7 @@ func (h *KoboHandler) mapContentIdToBookhoardUUID(ctx echo.Context, contentId st
|
|||||||
catalog, err := h.db.GetDeviceCatalogByKoboContentId(ctx.Request().Context(), contentId)
|
catalog, err := h.db.GetDeviceCatalogByKoboContentId(ctx.Request().Context(), contentId)
|
||||||
if err == nil && catalog.ID.Valid {
|
if err == nil && catalog.ID.Valid {
|
||||||
// Found! Use canonical Bookhoard UUID
|
// Found! Use canonical Bookhoard UUID
|
||||||
return uuid.UUID(catalog.BookmannUuid.Bytes), nil, "catalog_match"
|
return uuid.UUID(catalog.BookhoardUuid.Bytes), nil, "catalog_match"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: ContentId not found - check if it looks like a SHA-256 hash
|
// Step 2: ContentId not found - check if it looks like a SHA-256 hash
|
||||||
@@ -44,7 +44,7 @@ func (h *KoboHandler) mapContentIdToBookhoardUUID(ctx echo.Context, contentId st
|
|||||||
_, _ = h.db.CreateDeviceCatalog(ctx.Request().Context(), database.CreateDeviceCatalogParams{
|
_, _ = h.db.CreateDeviceCatalog(ctx.Request().Context(), database.CreateDeviceCatalogParams{
|
||||||
DeviceID: pgtype.UUID{Bytes: deviceID, Valid: true},
|
DeviceID: pgtype.UUID{Bytes: deviceID, Valid: true},
|
||||||
MediaItemID: pgtype.UUID{Bytes: mediaItem.ID.Bytes, Valid: true},
|
MediaItemID: pgtype.UUID{Bytes: mediaItem.ID.Bytes, Valid: true},
|
||||||
BookmannUuid: pgtype.UUID{Bytes: mediaItem.ID.Bytes, Valid: true},
|
BookhoardUuid: pgtype.UUID{Bytes: mediaItem.ID.Bytes, Valid: true},
|
||||||
KoboContentID: contentId,
|
KoboContentID: contentId,
|
||||||
ContentIDType: pgtype.Text{String: "sha256", Valid: true},
|
ContentIDType: pgtype.Text{String: "sha256", Valid: true},
|
||||||
Available: pgtype.Bool{Bool: true, Valid: true},
|
Available: pgtype.Bool{Bool: true, Valid: true},
|
||||||
@@ -64,7 +64,7 @@ func (h *KoboHandler) mapContentIdToBookhoardUUID(ctx echo.Context, contentId st
|
|||||||
_, _ = h.db.CreateDeviceCatalog(ctx.Request().Context(), database.CreateDeviceCatalogParams{
|
_, _ = h.db.CreateDeviceCatalog(ctx.Request().Context(), database.CreateDeviceCatalogParams{
|
||||||
DeviceID: pgtype.UUID{Bytes: deviceID, Valid: true},
|
DeviceID: pgtype.UUID{Bytes: deviceID, Valid: true},
|
||||||
MediaItemID: pgtype.UUID{Bytes: mediaItem.ID.Bytes, Valid: true},
|
MediaItemID: pgtype.UUID{Bytes: mediaItem.ID.Bytes, Valid: true},
|
||||||
BookmannUuid: pgtype.UUID{Bytes: mediaItem.ID.Bytes, Valid: true},
|
BookhoardUuid: pgtype.UUID{Bytes: mediaItem.ID.Bytes, Valid: true},
|
||||||
KoboContentID: contentId,
|
KoboContentID: contentId,
|
||||||
ContentIDType: pgtype.Text{String: "bookhoard_uuid", Valid: true},
|
ContentIDType: pgtype.Text{String: "bookhoard_uuid", Valid: true},
|
||||||
Available: pgtype.Bool{Bool: true, Valid: true},
|
Available: pgtype.Bool{Bool: true, Valid: true},
|
||||||
@@ -81,18 +81,18 @@ func (h *KoboHandler) mapContentIdToBookhoardUUID(ctx echo.Context, contentId st
|
|||||||
|
|
||||||
// mapBookhoardUUIDToKoboContentId maps Bookhoard UUID to Kobo ContentId
|
// mapBookhoardUUIDToKoboContentId maps Bookhoard UUID to Kobo ContentId
|
||||||
// Creates new entry in device_catalogs if not exists
|
// Creates new entry in device_catalogs if not exists
|
||||||
func (h *KoboHandler) mapBookhoardUUIDToKoboContentId(c echo.Context, bookmannUUID uuid.UUID, deviceID uuid.UUID) (string, error) {
|
func (h *KoboHandler) mapBookhoardUUIDToKoboContentId(c echo.Context, bookhoardUUID uuid.UUID, deviceID uuid.UUID) (string, error) {
|
||||||
// Check if catalog entry already exists
|
// Check if catalog entry already exists
|
||||||
catalog, err := h.db.GetDeviceCatalogByBookhoardUUID(c.Request().Context(), database.GetDeviceCatalogByBookhoardUUIDParams{
|
catalog, err := h.db.GetDeviceCatalogByBookhoardUUID(c.Request().Context(), database.GetDeviceCatalogByBookhoardUUIDParams{
|
||||||
DeviceID: pgtype.UUID{Bytes: deviceID, Valid: true},
|
DeviceID: pgtype.UUID{Bytes: deviceID, Valid: true},
|
||||||
BookmannUuid: pgtype.UUID{Bytes: bookmannUUID, Valid: true},
|
BookhoardUuid: pgtype.UUID{Bytes: bookhoardUUID, Valid: true},
|
||||||
})
|
})
|
||||||
if err == nil && catalog.ID.Valid {
|
if err == nil && catalog.ID.Valid {
|
||||||
return catalog.KoboContentID, nil
|
return catalog.KoboContentID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get media item to check for existing Kobo content ID
|
// Get media item to check for existing Kobo content ID
|
||||||
mediaItem, err := h.db.GetMediaItem(c.Request().Context(), pgtype.UUID{Bytes: bookmannUUID, Valid: true})
|
mediaItem, err := h.db.GetMediaItem(c.Request().Context(), pgtype.UUID{Bytes: bookhoardUUID, Valid: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -118,8 +118,8 @@ func (h *KoboHandler) mapBookhoardUUIDToKoboContentId(c echo.Context, bookmannUU
|
|||||||
// Create device catalog entry
|
// Create device catalog entry
|
||||||
_, err = h.db.CreateDeviceCatalog(c.Request().Context(), database.CreateDeviceCatalogParams{
|
_, err = h.db.CreateDeviceCatalog(c.Request().Context(), database.CreateDeviceCatalogParams{
|
||||||
DeviceID: pgtype.UUID{Bytes: deviceID, Valid: true},
|
DeviceID: pgtype.UUID{Bytes: deviceID, Valid: true},
|
||||||
MediaItemID: pgtype.UUID{Bytes: bookmannUUID, Valid: true},
|
MediaItemID: pgtype.UUID{Bytes: bookhoardUUID, Valid: true},
|
||||||
BookmannUuid: pgtype.UUID{Bytes: bookmannUUID, Valid: true},
|
BookhoardUuid: pgtype.UUID{Bytes: bookhoardUUID, Valid: true},
|
||||||
KoboContentID: koboContentId,
|
KoboContentID: koboContentId,
|
||||||
ContentIDType: pgtype.Text{String: contentIdType, Valid: true},
|
ContentIDType: pgtype.Text{String: contentIdType, Valid: true},
|
||||||
Available: pgtype.Bool{Bool: true, Valid: true},
|
Available: pgtype.Bool{Bool: true, Valid: true},
|
||||||
@@ -135,12 +135,12 @@ func (h *KoboHandler) mapBookhoardUUIDToKoboContentId(c echo.Context, bookmannUU
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getCollectionMetadataForBook retrieves collection names for a book
|
// getCollectionMetadataForBook retrieves collection names for a book
|
||||||
func (h *KoboHandler) getCollectionMetadataForBook(c echo.Context, bookmannUUID uuid.UUID, deviceID uuid.UUID) ([]string, error) {
|
func (h *KoboHandler) getCollectionMetadataForBook(c echo.Context, bookhoardUUID uuid.UUID, deviceID uuid.UUID) ([]string, error) {
|
||||||
device := c.Get("device").(database.Devices)
|
device := c.Get("device").(database.Devices)
|
||||||
pgDeviceID := pgtype.UUID{Bytes: device.ID.Bytes, Valid: true}
|
pgDeviceID := pgtype.UUID{Bytes: device.ID.Bytes, Valid: true}
|
||||||
|
|
||||||
// Get collections for this book
|
// Get collections for this book
|
||||||
collections, err := h.db.GetCollectionsForBook(c.Request().Context(), pgtype.UUID{Bytes: bookmannUUID, Valid: true})
|
collections, err := h.db.GetCollectionsForBook(c.Request().Context(), pgtype.UUID{Bytes: bookhoardUUID, Valid: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []string{}, nil
|
return []string{}, nil
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ func (h *KoboHandler) Initialization(c echo.Context) error {
|
|||||||
|
|
||||||
librarySync := []KoboLibraryBook{}
|
librarySync := []KoboLibraryBook{}
|
||||||
for _, item := range mediaItems {
|
for _, item := range mediaItems {
|
||||||
bookmannUUID := uuid.UUID(item.ID.Bytes)
|
bookhoardUUID := uuid.UUID(item.ID.Bytes)
|
||||||
|
|
||||||
progress, _ := h.db.GetUniversalProgress(c.Request().Context(), database.GetUniversalProgressParams{
|
progress, _ := h.db.GetUniversalProgress(c.Request().Context(), database.GetUniversalProgressParams{
|
||||||
MediaItemID: pgtype.UUID{Bytes: item.ID.Bytes, Valid: true},
|
MediaItemID: pgtype.UUID{Bytes: item.ID.Bytes, Valid: true},
|
||||||
@@ -319,13 +319,13 @@ func (h *KoboHandler) Initialization(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Phase 6: Use ContentId mapping instead of direct UUID
|
// Phase 6: Use ContentId mapping instead of direct UUID
|
||||||
koboContentId, err := h.mapBookhoardUUIDToKoboContentId(c, bookmannUUID, deviceUUID)
|
koboContentId, err := h.mapBookhoardUUIDToKoboContentId(c, bookhoardUUID, deviceUUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Fallback to entitlement_id or generate new one
|
// Fallback to entitlement_id or generate new one
|
||||||
if item.EntitlementID.Valid && item.EntitlementID.String != "" {
|
if item.EntitlementID.Valid && item.EntitlementID.String != "" {
|
||||||
koboContentId = item.EntitlementID.String
|
koboContentId = item.EntitlementID.String
|
||||||
} else {
|
} else {
|
||||||
koboContentId = "kobo_" + bookmannUUID.String()
|
koboContentId = "kobo_" + bookhoardUUID.String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +345,7 @@ func (h *KoboHandler) Initialization(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Phase 6: Get collection metadata for this book
|
// Phase 6: Get collection metadata for this book
|
||||||
collections, _ := h.getCollectionMetadataForBook(c, bookmannUUID, deviceUUID)
|
collections, _ := h.getCollectionMetadataForBook(c, bookhoardUUID, deviceUUID)
|
||||||
|
|
||||||
librarySync = append(librarySync, KoboLibraryBook{
|
librarySync = append(librarySync, KoboLibraryBook{
|
||||||
ContentId: koboContentId,
|
ContentId: koboContentId,
|
||||||
@@ -361,7 +361,7 @@ func (h *KoboHandler) Initialization(c echo.Context) error {
|
|||||||
MimeType: mimeType,
|
MimeType: mimeType,
|
||||||
FileSize: fileSize,
|
FileSize: fileSize,
|
||||||
Categories: collections,
|
Categories: collections,
|
||||||
BookhoardUUID: bookmannUUID.String(),
|
BookhoardUUID: bookhoardUUID.String(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ func (h *KoboHandler) Markup(c echo.Context) error {
|
|||||||
|
|
||||||
for _, readingSync := range req.ReadingSync {
|
for _, readingSync := range req.ReadingSync {
|
||||||
// Phase 6: Use ContentId mapping with fallback logic
|
// Phase 6: Use ContentId mapping with fallback logic
|
||||||
bookmannUUID, err, _ := h.mapContentIdToBookhoardUUID(c, readingSync.ContentId, deviceUUID)
|
bookhoardUUID, err, _ := h.mapContentIdToBookhoardUUID(c, readingSync.ContentId, deviceUUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Unlinked book detected
|
// Unlinked book detected
|
||||||
unlinkedBooks++
|
unlinkedBooks++
|
||||||
@@ -405,7 +405,7 @@ func (h *KoboHandler) Markup(c echo.Context) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
pgMediaUUID := pgtype.UUID{Bytes: bookmannUUID, Valid: true}
|
pgMediaUUID := pgtype.UUID{Bytes: bookhoardUUID, Valid: true}
|
||||||
|
|
||||||
percentage := readingSync.PercentRead / 100.0
|
percentage := readingSync.PercentRead / 100.0
|
||||||
|
|
||||||
@@ -421,7 +421,7 @@ func (h *KoboHandler) Markup(c echo.Context) error {
|
|||||||
markupsSynced++
|
markupsSynced++
|
||||||
|
|
||||||
h.connManager.BroadcastProgressUpdate(
|
h.connManager.BroadcastProgressUpdate(
|
||||||
bookmannUUID,
|
bookhoardUUID,
|
||||||
percentage,
|
percentage,
|
||||||
wsync.SourceDevice{
|
wsync.SourceDevice{
|
||||||
ID: uuid.UUID(userID).String(),
|
ID: uuid.UUID(userID).String(),
|
||||||
@@ -434,13 +434,13 @@ func (h *KoboHandler) Markup(c echo.Context) error {
|
|||||||
|
|
||||||
for _, bookmarkSync := range req.BookmarkSync {
|
for _, bookmarkSync := range req.BookmarkSync {
|
||||||
// Phase 6: Use ContentId mapping with fallback logic
|
// Phase 6: Use ContentId mapping with fallback logic
|
||||||
bookmannUUID, err, _ := h.mapContentIdToBookhoardUUID(c, bookmarkSync.ContentId, deviceUUID)
|
bookhoardUUID, err, _ := h.mapContentIdToBookhoardUUID(c, bookmarkSync.ContentId, deviceUUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Unlinked book - skip
|
// Unlinked book - skip
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
pgMediaUUID := pgtype.UUID{Bytes: bookmannUUID, Valid: true}
|
pgMediaUUID := pgtype.UUID{Bytes: bookhoardUUID, Valid: true}
|
||||||
|
|
||||||
switch bookmarkSync.BookmarkType {
|
switch bookmarkSync.BookmarkType {
|
||||||
case "annotation":
|
case "annotation":
|
||||||
@@ -512,13 +512,13 @@ func (h *KoboHandler) Bookmark(c echo.Context) error {
|
|||||||
|
|
||||||
for _, bookmarkSync := range req.BookmarkSync {
|
for _, bookmarkSync := range req.BookmarkSync {
|
||||||
// Phase 6: Use ContentId mapping with fallback logic
|
// Phase 6: Use ContentId mapping with fallback logic
|
||||||
bookmannUUID, err, _ := h.mapContentIdToBookhoardUUID(c, bookmarkSync.ContentId, deviceUUID)
|
bookhoardUUID, err, _ := h.mapContentIdToBookhoardUUID(c, bookmarkSync.ContentId, deviceUUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Unlinked book - skip
|
// Unlinked book - skip
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
pgMediaUUID := pgtype.UUID{Bytes: bookmannUUID, Valid: true}
|
pgMediaUUID := pgtype.UUID{Bytes: bookhoardUUID, Valid: true}
|
||||||
|
|
||||||
switch bookmarkSync.BookmarkType {
|
switch bookmarkSync.BookmarkType {
|
||||||
case "annotation":
|
case "annotation":
|
||||||
@@ -577,13 +577,13 @@ func (h *KoboHandler) AnalyticsGettests(c echo.Context) error {
|
|||||||
|
|
||||||
for _, test := range req {
|
for _, test := range req {
|
||||||
// Phase 6: Use ContentId mapping with fallback logic
|
// Phase 6: Use ContentId mapping with fallback logic
|
||||||
bookmannUUID, err, _ := h.mapContentIdToBookhoardUUID(c, test.ContentId, deviceUUID)
|
bookhoardUUID, err, _ := h.mapContentIdToBookhoardUUID(c, test.ContentId, deviceUUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Unlinked book - skip
|
// Unlinked book - skip
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
pgMediaUUID := pgtype.UUID{Bytes: bookmannUUID, Valid: true}
|
pgMediaUUID := pgtype.UUID{Bytes: bookhoardUUID, Valid: true}
|
||||||
percentage := test.PercentRead / 100.0
|
percentage := test.PercentRead / 100.0
|
||||||
|
|
||||||
_, err = h.db.UpdateUniversalProgress(c.Request().Context(), database.UpdateUniversalProgressParams{
|
_, err = h.db.UpdateUniversalProgress(c.Request().Context(), database.UpdateUniversalProgressParams{
|
||||||
@@ -596,7 +596,7 @@ func (h *KoboHandler) AnalyticsGettests(c echo.Context) error {
|
|||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
h.connManager.BroadcastProgressUpdate(
|
h.connManager.BroadcastProgressUpdate(
|
||||||
bookmannUUID,
|
bookhoardUUID,
|
||||||
percentage,
|
percentage,
|
||||||
wsync.SourceDevice{
|
wsync.SourceDevice{
|
||||||
ID: uuid.UUID(userID).String(),
|
ID: uuid.UUID(userID).String(),
|
||||||
@@ -654,13 +654,13 @@ func (h *KoboHandler) SyncFromServer(c echo.Context) error {
|
|||||||
|
|
||||||
for _, syncData := range req {
|
for _, syncData := range req {
|
||||||
// Phase 6: Use ContentId mapping with fallback logic
|
// Phase 6: Use ContentId mapping with fallback logic
|
||||||
bookmannUUID, err, _ := h.mapContentIdToBookhoardUUID(c, syncData.ContentId, deviceUUID)
|
bookhoardUUID, err, _ := h.mapContentIdToBookhoardUUID(c, syncData.ContentId, deviceUUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Unlinked book - skip
|
// Unlinked book - skip
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
pgMediaUUID := pgtype.UUID{Bytes: bookmannUUID, Valid: true}
|
pgMediaUUID := pgtype.UUID{Bytes: bookhoardUUID, Valid: true}
|
||||||
|
|
||||||
percentage := syncData.PercentRead / 100.0
|
percentage := syncData.PercentRead / 100.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user