bichnhan2701 commited on
Commit
2faaa56
·
1 Parent(s): 357cf4e
Files changed (2) hide show
  1. app/api/notes.py +2 -2
  2. app/services/storage.py +0 -6
app/api/notes.py CHANGED
@@ -1,7 +1,7 @@
1
  from fastapi import APIRouter, BackgroundTasks, HTTPException
2
  from pydantic import BaseModel
3
  from typing import Optional, List
4
- from app.services.storage import create_note, get_note
5
  from app.jobs.enrichment_job import run_enrichment
6
 
7
  router = APIRouter(prefix="/notes")
@@ -20,7 +20,7 @@ class CreateNoteRequest(BaseModel):
20
 
21
  @router.post("")
22
  async def create_note(req: CreateNoteRequest, bg: BackgroundTasks):
23
- create_note(req.note_id, req.dict())
24
 
25
  if req.generate:
26
  bg.add_task(run_enrichment, req.note_id, req.generate)
 
1
  from fastapi import APIRouter, BackgroundTasks, HTTPException
2
  from pydantic import BaseModel
3
  from typing import Optional, List
4
+ from app.services.storage import create_note as storage_create_note, get_note
5
  from app.jobs.enrichment_job import run_enrichment
6
 
7
  router = APIRouter(prefix="/notes")
 
20
 
21
  @router.post("")
22
  async def create_note(req: CreateNoteRequest, bg: BackgroundTasks):
23
+ storage_create_note(req.note_id, req.dict())
24
 
25
  if req.generate:
26
  bg.add_task(run_enrichment, req.note_id, req.generate)
app/services/storage.py CHANGED
@@ -16,12 +16,6 @@ def create_note(note_id: str, payload: dict):
16
  db.collection(COLLECTION).document(note_id).set(payload)
17
  logging.info(f"[NoteService] create_note: saved id={note_id}")
18
 
19
- def get_note(note_id: str):
20
- logging.info(f"[NoteService] get_note: id={note_id}")
21
- doc = db.collection(COLLECTION).document(note_id).get()
22
- logging.info(f"[NoteService] get_note: exists={doc.exists}")
23
- return doc.to_dict() if doc.exists else None
24
-
25
 
26
  def update_note(note_id: str, data: dict = None, status: str = None):
27
  updates = {"updated_at": datetime.utcnow()}
 
16
  db.collection(COLLECTION).document(note_id).set(payload)
17
  logging.info(f"[NoteService] create_note: saved id={note_id}")
18
 
 
 
 
 
 
 
19
 
20
  def update_note(note_id: str, data: dict = None, status: str = None):
21
  updates = {"updated_at": datetime.utcnow()}