Skip to content

Commit d38b9ba

Browse files
committed
Fixed lint and typescript errors from new changes
1 parent 9033795 commit d38b9ba

File tree

18 files changed

+150
-149
lines changed

18 files changed

+150
-149
lines changed

backend/app/api/main.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
from fastapi import APIRouter
22

3-
from app.api.routes import galleries, invitations, items, login, organizations, private, project_access, projects, users, utils
3+
from app.api.routes import (
4+
galleries,
5+
invitations,
6+
items,
7+
login,
8+
organizations,
9+
private,
10+
project_access,
11+
projects,
12+
users,
13+
utils,
14+
)
415
from app.core.config import settings
516

617
api_router = APIRouter()

backend/app/api/routes/galleries.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def read_galleries(
3737
project = crud.get_project(session=session, project_id=project_id)
3838
if not project:
3939
raise HTTPException(status_code=404, detail="Project not found")
40-
40+
4141
# Check access based on user type
4242
if user_type == "client":
4343
# Client must have explicit access
@@ -62,15 +62,15 @@ def read_galleries(
6262
session=session, user_id=current_user.id, skip=0, limit=1000
6363
)
6464
project_ids = [p.id for p in accessible_projects]
65-
65+
6666
# Get galleries for all accessible projects
6767
galleries = []
6868
for pid in project_ids[skip:skip+limit]:
6969
project_galleries = crud.get_galleries_by_project(
7070
session=session, project_id=pid, skip=0, limit=100
7171
)
7272
galleries.extend(project_galleries)
73-
73+
7474
count = sum(
7575
len(crud.get_galleries_by_project(session=session, project_id=pid, skip=0, limit=1000))
7676
for pid in project_ids
@@ -81,7 +81,7 @@ def read_galleries(
8181
raise HTTPException(
8282
status_code=400, detail="User is not part of an organization"
8383
)
84-
84+
8585
galleries = crud.get_galleries_by_organization(
8686
session=session,
8787
organization_id=current_user.organization_id,
@@ -103,13 +103,13 @@ def create_gallery(
103103
Create new gallery. Only team members can create galleries.
104104
"""
105105
user_type = getattr(current_user, "user_type", None)
106-
106+
107107
# Only team members can create galleries
108108
if user_type != "team_member":
109109
raise HTTPException(
110110
status_code=403, detail="Only team members can create galleries"
111111
)
112-
112+
113113
if not current_user.organization_id:
114114
raise HTTPException(
115115
status_code=400, detail="User is not part of an organization"
@@ -138,7 +138,7 @@ def read_gallery(session: SessionDep, current_user: CurrentUser, id: uuid.UUID)
138138
project = crud.get_project(session=session, project_id=gallery.project_id)
139139
if not project:
140140
raise HTTPException(status_code=404, detail="Project not found")
141-
141+
142142
if user_type == "client":
143143
# Client must have access to the project
144144
if not crud.user_has_project_access(
@@ -165,13 +165,13 @@ def update_gallery(
165165
Update a gallery. Only team members can update galleries.
166166
"""
167167
user_type = getattr(current_user, "user_type", None)
168-
168+
169169
# Only team members can update galleries
170170
if user_type != "team_member":
171171
raise HTTPException(
172172
status_code=403, detail="Only team members can update galleries"
173173
)
174-
174+
175175
gallery = crud.get_gallery(session=session, gallery_id=id)
176176
if not gallery:
177177
raise HTTPException(status_code=404, detail="Gallery not found")
@@ -195,13 +195,13 @@ def delete_gallery(
195195
Delete a gallery. Only team members can delete galleries.
196196
"""
197197
user_type = getattr(current_user, "user_type", None)
198-
198+
199199
# Only team members can delete galleries
200200
if user_type != "team_member":
201201
raise HTTPException(
202202
status_code=403, detail="Only team members can delete galleries"
203203
)
204-
204+
205205
gallery = crud.get_gallery(session=session, gallery_id=id)
206206
if not gallery:
207207
raise HTTPException(status_code=404, detail="Gallery not found")

backend/app/api/routes/organizations.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
OrganizationCreate,
1111
OrganizationPublic,
1212
OrganizationUpdate,
13-
Message,
1413
)
1514

1615
router = APIRouter()
@@ -33,25 +32,25 @@ def create_organization(
3332
status_code=403,
3433
detail="Only team members can create organizations",
3534
)
36-
35+
3736
# Check user doesn't already have an organization
3837
if current_user.organization_id:
3938
raise HTTPException(
4039
status_code=400,
4140
detail="You already belong to an organization",
4241
)
43-
42+
4443
# Create the organization
4544
organization = crud.create_organization(
4645
session=session, organization_in=organization_in
4746
)
48-
47+
4948
# Assign the user to the new organization
5049
current_user.organization_id = organization.id
5150
session.add(current_user)
5251
session.commit()
5352
session.refresh(current_user)
54-
53+
5554
return organization
5655

5756

@@ -66,14 +65,14 @@ def read_organization(
6665
organization = session.get(Organization, organization_id)
6766
if not organization:
6867
raise HTTPException(status_code=404, detail="Organization not found")
69-
68+
7069
# Only allow viewing own organization (unless superuser)
7170
if not current_user.is_superuser and current_user.organization_id != organization_id:
7271
raise HTTPException(
7372
status_code=403,
7473
detail="Not enough permissions",
7574
)
76-
75+
7776
return organization
7877

7978

@@ -92,19 +91,19 @@ def update_organization(
9291
organization = session.get(Organization, organization_id)
9392
if not organization:
9493
raise HTTPException(status_code=404, detail="Organization not found")
95-
94+
9695
# Only allow updating own organization (unless superuser)
9796
if not current_user.is_superuser and current_user.organization_id != organization_id:
9897
raise HTTPException(
9998
status_code=403,
10099
detail="Not enough permissions",
101100
)
102-
101+
103102
update_dict = organization_in.model_dump(exclude_unset=True)
104103
organization.sqlmodel_update(update_dict)
105104
session.add(organization)
106105
session.commit()
107106
session.refresh(organization)
108-
107+
109108
return organization
110109

backend/app/api/routes/project_access.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from app.models import (
99
Message,
1010
ProjectAccessCreate,
11-
ProjectAccessPublic,
1211
ProjectAccessesPublic,
13-
ProjectAccessWithUser,
12+
ProjectAccessPublic,
1413
ProjectAccessUpdate,
14+
User,
1515
)
1616

1717
router = APIRouter()
@@ -38,24 +38,24 @@ def grant_project_access(
3838
status_code=403,
3939
detail="Only team members can invite clients to projects",
4040
)
41-
41+
4242
# Check if project exists and user has access to it
4343
project = crud.get_project(session=session, project_id=project_id)
4444
if not project:
4545
raise HTTPException(status_code=404, detail="Project not found")
46-
46+
4747
# Check if current user's organization owns the project
4848
if not current_user.organization_id or current_user.organization_id != project.organization_id:
4949
raise HTTPException(
5050
status_code=403,
5151
detail="You don't have permission to manage this project",
5252
)
53-
53+
5454
# Check if user to be invited exists
55-
user_to_invite = session.get(crud.User, user_id)
55+
user_to_invite = session.get(User, user_id)
5656
if not user_to_invite:
5757
raise HTTPException(status_code=404, detail="User not found")
58-
58+
5959
# Create access
6060
access_in = ProjectAccessCreate(
6161
project_id=project_id,
@@ -83,7 +83,7 @@ def read_project_access_list(
8383
project = crud.get_project(session=session, project_id=project_id)
8484
if not project:
8585
raise HTTPException(status_code=404, detail="Project not found")
86-
86+
8787
# Check permissions
8888
if getattr(current_user, "user_type", None) == "team_member":
8989
if current_user.organization_id != project.organization_id:
@@ -94,7 +94,7 @@ def read_project_access_list(
9494
session=session, project_id=project_id, user_id=current_user.id
9595
):
9696
raise HTTPException(status_code=403, detail="Access denied")
97-
97+
9898
access_list = crud.get_project_access_list(session=session, project_id=project_id)
9999
return ProjectAccessesPublic(data=access_list, count=len(access_list))
100100

@@ -117,16 +117,16 @@ def revoke_project_access(
117117
status_code=403,
118118
detail="Only team members can revoke project access",
119119
)
120-
120+
121121
# Check if project exists
122122
project = crud.get_project(session=session, project_id=project_id)
123123
if not project:
124124
raise HTTPException(status_code=404, detail="Project not found")
125-
125+
126126
# Check permissions
127127
if current_user.organization_id != project.organization_id:
128128
raise HTTPException(status_code=403, detail="Access denied")
129-
129+
130130
# Revoke access
131131
crud.delete_project_access(
132132
session=session, project_id=project_id, user_id=user_id
@@ -153,23 +153,23 @@ def update_project_access_permissions(
153153
status_code=403,
154154
detail="Only team members can update project access",
155155
)
156-
156+
157157
# Check if project exists
158158
project = crud.get_project(session=session, project_id=project_id)
159159
if not project:
160160
raise HTTPException(status_code=404, detail="Project not found")
161-
161+
162162
# Check permissions
163163
if current_user.organization_id != project.organization_id:
164164
raise HTTPException(status_code=403, detail="Access denied")
165-
165+
166166
# Get existing access
167167
db_access = crud.get_project_access(
168168
session=session, project_id=project_id, user_id=user_id
169169
)
170170
if not db_access:
171171
raise HTTPException(status_code=404, detail="Access not found")
172-
172+
173173
# Update access
174174
access = crud.update_project_access(
175175
session=session, db_access=db_access, access_in=access_in

backend/app/api/routes/projects.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def read_dashboard_stats(session: SessionDep, current_user: CurrentUser) -> Any:
6868
raise HTTPException(
6969
status_code=403, detail="Dashboard stats only available to team members"
7070
)
71-
71+
7272
if not current_user.organization_id:
7373
raise HTTPException(
7474
status_code=400, detail="User is not part of an organization"
@@ -91,7 +91,7 @@ def create_project(
9191
raise HTTPException(
9292
status_code=403, detail="Only team members can create projects"
9393
)
94-
94+
9595
if not current_user.organization_id:
9696
raise HTTPException(
9797
status_code=400, detail="User is not part of an organization"
@@ -102,15 +102,15 @@ def create_project(
102102
raise HTTPException(status_code=403, detail="Not enough permissions")
103103

104104
project = crud.create_project(session=session, project_in=project_in)
105-
105+
106106
# Automatically create a gallery for the project
107107
gallery_in = GalleryCreate(
108108
name=f"{project.name} - Gallery",
109109
project_id=project.id,
110110
status="draft",
111111
)
112112
crud.create_gallery(session=session, gallery_in=gallery_in)
113-
113+
114114
return project
115115

116116

@@ -154,7 +154,7 @@ def update_project(
154154
raise HTTPException(
155155
status_code=403, detail="Only team members can update projects"
156156
)
157-
157+
158158
project = crud.get_project(session=session, project_id=id)
159159
if not project:
160160
raise HTTPException(status_code=404, detail="Project not found")
@@ -181,7 +181,7 @@ def delete_project(
181181
raise HTTPException(
182182
status_code=403, detail="Only team members can delete projects"
183183
)
184-
184+
185185
project = crud.get_project(session=session, project_id=id)
186186
if not project:
187187
raise HTTPException(status_code=404, detail="Project not found")

0 commit comments

Comments
 (0)