Skip to content

Commit c9ce4cf

Browse files
Added one drive path to users table (#369)
* Added one drive path to users table * Added onedrive path to get user * Update one drive field as its own endpoint * chore: merge alembic files * fix: alembic revision * Submodules merge --------- Co-authored-by: andhreljaKern <[email protected]>
1 parent 68e3d9d commit c9ce4cf

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""One drive path for desktop version
2+
3+
Revision ID: e3e108cd4b22
4+
Revises: 5186966ea4db
5+
Create Date: 2025-12-10 15:30:56.732793
6+
7+
"""
8+
9+
from alembic import op
10+
import sqlalchemy as sa
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = "e3e108cd4b22"
15+
down_revision = "5186966ea4db"
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.add_column("user", sa.Column("one_drive_path", sa.String(), nullable=True))
23+
# ### end Alembic commands ###
24+
25+
26+
def downgrade():
27+
# ### commands auto generated by Alembic - please adjust! ###
28+
op.drop_column("user", "one_drive_path")
29+
# ### end Alembic commands ###

fast_api/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,3 +550,7 @@ class InboxMailCreateRequest(BaseModel):
550550

551551
class UpdateInboxMailThreadProgressRequest(BaseModel):
552552
progressState: str
553+
554+
555+
class UpdateOneDriveFieldRequest(BaseModel):
556+
oneDrivePath: StrictStr

fast_api/routes/organization.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
MappedSortedPaginatedUsers,
1414
MissingUsersBody,
1515
RemoveUserToOrganizationBody,
16+
UpdateOneDriveFieldRequest,
1617
)
1718
from controller.auth import manager as auth_manager
1819
from controller.auth import kratos
@@ -50,6 +51,7 @@
5051
"email",
5152
"use_new_cognition_ui",
5253
"auto_logout_minutes",
54+
"one_drive_path",
5355
}
5456
USER_INFO_RENAME_MAP = {"email": "mail"}
5557
ALL_ORGANIZATIONS_WHITELIST = {
@@ -285,6 +287,14 @@ def set_language_display(request: Request, field: str, value: str):
285287
return get_silent_success()
286288

287289

290+
# in use cognition-ui (15.12.25)
291+
@router.post("/update-one-drive-field")
292+
def set_one_drive_field(request: Request, body: UpdateOneDriveFieldRequest = Body(...)):
293+
user_id = auth_manager.get_user_id_by_info(request.state.info)
294+
user_manager.update_user_field(user_id, "one_drive_path", body.oneDrivePath)
295+
return get_silent_success()
296+
297+
288298
# in use admin-dashboard (08.01.25)
289299
@router.post("/mapped-sorted-paginated-users")
290300
def get_mapped_sorted_paginated_users(

0 commit comments

Comments
 (0)