mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-02 16:50:20 +03:00
Update project schema and fix tests
This commit is contained in:
parent
8ab34924b5
commit
be4b87e8cd
@ -123,8 +123,7 @@ async def create_project(
|
|||||||
|
|
||||||
controller = Controller.instance()
|
controller = Controller.instance()
|
||||||
project_dict = jsonable_encoder(project_data, exclude_unset=True)
|
project_dict = jsonable_encoder(project_data, exclude_unset=True)
|
||||||
if "created_by" not in project_dict:
|
project_dict["created_by"] = current_user.username
|
||||||
project_dict["created_by"] = current_user.username
|
|
||||||
project = await controller.add_project(**project_dict)
|
project = await controller.add_project(**project_dict)
|
||||||
return project.asdict()
|
return project.asdict()
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,6 @@ class ProjectBase(BaseModel):
|
|||||||
show_interface_labels: Optional[bool] = Field(None, description="Show interface labels on the drawing area")
|
show_interface_labels: Optional[bool] = Field(None, description="Show interface labels on the drawing area")
|
||||||
supplier: Optional[Supplier] = Field(None, description="Supplier of the project")
|
supplier: Optional[Supplier] = Field(None, description="Supplier of the project")
|
||||||
variables: Optional[List[Variable]] = Field(None, description="Variables required to run the project")
|
variables: Optional[List[Variable]] = Field(None, description="Variables required to run the project")
|
||||||
created_by: Optional[str] = Field(None, description="Username of the user who created the project")
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectCreate(ProjectBase):
|
class ProjectCreate(ProjectBase):
|
||||||
@ -97,6 +96,7 @@ class Project(ProjectBase):
|
|||||||
name: Optional[str] = None
|
name: Optional[str] = None
|
||||||
status: Optional[ProjectStatus] = None
|
status: Optional[ProjectStatus] = None
|
||||||
filename: Optional[str] = None
|
filename: Optional[str] = None
|
||||||
|
created_by: Optional[str] = Field(None, description="Username of the user who created the project")
|
||||||
|
|
||||||
|
|
||||||
class ProjectFile(BaseModel):
|
class ProjectFile(BaseModel):
|
||||||
|
|||||||
@ -59,7 +59,8 @@ async def test_project_to_topology_empty(tmpdir):
|
|||||||
"type": "topology",
|
"type": "topology",
|
||||||
"supplier": None,
|
"supplier": None,
|
||||||
"variables": None,
|
"variables": None,
|
||||||
"version": __version__
|
"version": __version__,
|
||||||
|
"created_by": None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user