Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: 1155 implement project frontend #1161

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1fc5b12
frontend project page
longshuicy Jul 30, 2024
d858ef8
initial commit new model
tcnichol Jul 29, 2024
6540704
adding db, out, in, etc
tcnichol Jul 29, 2024
a5e6ea0
save and get methods
tcnichol Jul 29, 2024
3023c62
get method
tcnichol Jul 29, 2024
e71fc40
add users to project
tcnichol Jul 29, 2024
e030b87
adding to do
tcnichol Jul 29, 2024
f832ca4
add a remove project member
tcnichol Jul 29, 2024
2c9a050
routes for deleting and adding, removing members
tcnichol Jul 29, 2024
662d9b5
"project" not "group"
tcnichol Jul 29, 2024
f116dc4
methods for adding and removing datasets from projects
tcnichol Jul 30, 2024
3c371a1
remove license
tcnichol Jul 30, 2024
ceb9b1a
adding and removing folders and files
tcnichol Jul 30, 2024
d6f68dd
only add if a file, folder, dataset id not in the project already
tcnichol Jul 30, 2024
715ba83
beginning project tests
tcnichol Jul 30, 2024
01e16e9
add test add dataset to project
tcnichol Jul 30, 2024
c2024c2
formatting
tcnichol Jul 30, 2024
c6073f6
adding routes to main
tcnichol Jul 30, 2024
1c4d005
get project works
tcnichol Jul 30, 2024
dd02536
fixing add dataset to project
tcnichol Jul 30, 2024
7078478
default value empty lists not none
tcnichol Jul 30, 2024
9799ff0
fixing the folder part
tcnichol Jul 30, 2024
2803590
fixing filex
tcnichol Jul 30, 2024
cb0c688
add pydantic id not string
tcnichol Jul 30, 2024
f42e62a
file not folder
tcnichol Jul 30, 2024
d4ce2b4
formatting
tcnichol Jul 30, 2024
6f9d78e
mocks
longshuicy Jul 30, 2024
d2ef7ce
mock the folder part
longshuicy Jul 30, 2024
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
7 changes: 4 additions & 3 deletions .run/Python tests in tests.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<module name="clowder2" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="SDK_HOME" value="$USER_HOME$/.virtualenvs/clowder2-Ai7Xc8E9/bin/python" />
<option name="SDK_NAME" value="Python 3.7 (clowder2-Ai7Xc8E9)" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/backend/app/tests" />
<option name="IS_MODULE_SDK" value="true" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
Expand All @@ -14,4 +15,4 @@
<option name="_new_targetType" value="&quot;PATH&quot;" />
<method v="2" />
</configuration>
</component>
</component>
8 changes: 8 additions & 0 deletions backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
VisualizationDataDBViewList,
VisualizationDataFreezeDB,
)
from app.models.project import ProjectDB
from app.routers import (
authentication,
authorization,
Expand Down Expand Up @@ -66,6 +67,7 @@
thumbnails,
users,
visualization,
projects,
)

# setup loggers
Expand Down Expand Up @@ -250,6 +252,11 @@
prefix="/public_thumbnails",
tags=["public_thumbnails"],
)
api_router.include_router(
projects.router,
prefix="/projects",
tags=["projects"],
)
api_router.include_router(
licenses.router,
prefix="/licenses",
Expand Down Expand Up @@ -315,6 +322,7 @@ async def startup_beanie():
ThumbnailFreezeDB,
ThumbnailDBViewList,
LicenseDB,
ProjectDB,
],
recreate_views=True,
)
Expand Down
42 changes: 42 additions & 0 deletions backend/app/models/project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from datetime import datetime
from enum import Enum, auto
from typing import List, Optional

import pymongo
from app.models.authorization import AuthorizationDB, RoleType
from app.models.groups import GroupOut
from app.models.users import UserOut
from beanie import Document, PydanticObjectId, View
from pydantic import BaseModel, Field


class Member(BaseModel):
user: UserOut
editor: bool = False


class ProjectBase(BaseModel):
id: PydanticObjectId = Field(default_factory=PydanticObjectId, alias="_id")
name: str
description: Optional[str] = None
created: datetime = Field(default_factory=datetime.utcnow)
modified: datetime = Field(default_factory=datetime.utcnow)
dataset_ids: Optional[List[PydanticObjectId]] = []
folder_ids: Optional[List[PydanticObjectId]] = []
file_ids: Optional[List[PydanticObjectId]] = []
creator: UserOut
users: List[Member] = []


class ProjectDB(Document, ProjectBase):
class Settings:
name = "projects"


class ProjectIn(ProjectBase):
pass


class ProjectOut(ProjectDB):
class Config:
fields = {"id": "id"}
Loading
Loading