1
1
from fastapi import APIRouter , Depends , HTTPException
2
2
from sqlmodel import Session , select
3
3
from typing import List
4
- from src .models import AllocationResult , MedicineRequest , User
4
+ from src .models import AllocationResult
5
5
from src .schemas import (
6
6
AllocationResultCreate ,
7
7
AllocationResultRead ,
8
8
AllocationResult as AllocationResultSchema ,
9
9
)
10
10
from src .dependencies import get_session
11
- from src .security import get_current_user
12
11
13
12
router = APIRouter (prefix = "/allocations" , tags = ["allocations" ])
14
13
17
16
def create_allocation (
18
17
allocation : AllocationResultCreate ,
19
18
session : Session = Depends (get_session ),
20
- current_user : User = Depends (get_current_user ),
21
19
):
22
20
db_allocation = AllocationResult (** allocation .dict ())
23
21
session .add (db_allocation )
@@ -31,7 +29,6 @@ def read_allocations(
31
29
skip : int = 0 ,
32
30
limit : int = 100 ,
33
31
session : Session = Depends (get_session ),
34
- current_user : User = Depends (get_current_user ),
35
32
):
36
33
allocations = session .exec (select (AllocationResult ).offset (skip ).limit (limit )).all ()
37
34
return allocations
@@ -41,7 +38,6 @@ def read_allocations(
41
38
def read_allocation (
42
39
allocation_id : int ,
43
40
session : Session = Depends (get_session ),
44
- current_user : User = Depends (get_current_user ),
45
41
):
46
42
allocation = session .get (AllocationResult , allocation_id )
47
43
if allocation is None :
@@ -53,7 +49,6 @@ def read_allocation(
53
49
def delete_allocation (
54
50
allocation_id : int ,
55
51
session : Session = Depends (get_session ),
56
- current_user : User = Depends (get_current_user ),
57
52
):
58
53
allocation = session .get (AllocationResult , allocation_id )
59
54
if allocation is None :
@@ -67,7 +62,6 @@ def delete_allocation(
67
62
def read_allocation_by_request (
68
63
request_id : int ,
69
64
session : Session = Depends (get_session ),
70
- current_user : User = Depends (get_current_user ),
71
65
):
72
66
allocation = session .exec (
73
67
select (AllocationResult ).where (AllocationResult .request_id == request_id )
0 commit comments