Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backend/models/websocket_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewStandardMessage(msgType string, event string, payload map[string]interfa
ID: uuid.New().String(),
Type: msgType,
Event: event,
Timestamp: time.Now(),
Timestamp: time.Now().UTC(),
Payload: payload,
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/backend/routes/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func SetupDebugRoutes(router *gin.Engine, db *database.Database) {
c.JSON(http.StatusOK, gin.H{
"exists": false,
"error": result.Error.Error(),
"time": time.Now(),
"time": time.Now().UTC(),
})
return
}
Expand All @@ -35,7 +35,7 @@ func SetupDebugRoutes(router *gin.Engine, db *database.Database) {
"id": note.ID,
"title": note.Title,
"notebook_id": note.NotebookID,
"time": time.Now(),
"time": time.Now().UTC(),
})
})

Expand All @@ -47,7 +47,7 @@ func SetupDebugRoutes(router *gin.Engine, db *database.Database) {
c.JSON(http.StatusOK, gin.H{
"pending_events": len(events),
"events": events,
"time": time.Now(),
"time": time.Now().UTC(),
})
})
}
Expand Down
10 changes: 5 additions & 5 deletions src/backend/services/block_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func (s *BlockService) CreateBlock(db *database.Database, blockData map[string]i
metadata := models.BlockMetadata{}
if metaData, ok := blockData["metadata"].(map[string]interface{}); ok {
metadata = models.BlockMetadata(metaData)
metadata["_sync_source"] = "block"
metadata["block_id"] = blockID
}

Expand Down Expand Up @@ -256,7 +255,7 @@ func (s *BlockService) UpdateBlock(db *database.Database, id string, blockData m
}

if blockType, ok := blockData["type"].(string); ok {
eventData["type"] = blockType
eventData["block_type"] = blockType
}

// Create the event
Expand Down Expand Up @@ -341,9 +340,10 @@ func (s *BlockService) DeleteBlock(db *database.Database, id string, params map[
string(broker.BlockDeleted), // Use standard event type
"block",
map[string]interface{}{
"block_id": block.ID.String(),
"note_id": block.NoteID.String(),
"user_id": block.UserID.String(),
"block_id": block.ID.String(),
"note_id": block.NoteID.String(),
"user_id": block.UserID.String(),
"block_type": string(block.Type),
},
)

Expand Down
3 changes: 1 addition & 2 deletions src/backend/services/event_handler_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,10 @@ func (s *EventHandlerService) dispatchEvent(event models.Event) error {
}

// Mark the event as dispatched in the database
now := time.Now()
return s.db.DB.Model(&event).Updates(map[string]interface{}{
"dispatched": true,
"dispatched_at": now,
"status": "completed",
"dispatched_at": time.Now().UTC(),
}).Error
}

Expand Down
4 changes: 2 additions & 2 deletions src/backend/services/note_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (s *NoteService) UpdateNote(db *database.Database, id string, noteData map[
note.NotebookID = notebookID
}

note.UpdatedAt = time.Now()
note.UpdatedAt = time.Now().UTC()

if err := tx.Save(&note).Error; err != nil {
tx.Rollback()
Expand Down Expand Up @@ -327,7 +327,7 @@ func (s *NoteService) DeleteNote(db *database.Database, id string, params map[st
tx.Rollback()
return errors.New("not authorized to delete this note")
}

if err := tx.Exec("UPDATE blocks SET deleted_at = NOW() WHERE note_id = ?", id).Error; err != nil {
tx.Rollback()
return err
Expand Down
2 changes: 1 addition & 1 deletion src/backend/services/notebook_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (s *NotebookService) UpdateNotebook(db *database.Database, id string, noteb
notebook.Description = description
}

notebook.UpdatedAt = time.Now()
notebook.UpdatedAt = time.Now().UTC()

if err := tx.Save(&notebook).Error; err != nil {
tx.Rollback()
Expand Down
Loading