Skip to content

Commit

Permalink
add pydantic model classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZihengSun committed Jun 29, 2024
1 parent 91a33af commit 34f9f94
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pygeoweaver/database_management/pgw_checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pydantic import BaseModel
from typing import Optional
import uuid
from datetime import datetime

class Checkpoint(BaseModel):
id: Optional[uuid.UUID]
executionId: str
edges: str
nodes: str
workflow: Optional[str]
createdAt: Optional[datetime]
12 changes: 12 additions & 0 deletions pygeoweaver/database_management/pgw_environment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pydantic import BaseModel, Field
from typing import Optional

class Environment(BaseModel):
id: str
name: str
type: str
bin: str
pyenv: str
basedir: str
hostid: Optional[str] = None # Use Optional to allow for null values
settings: Optional[str] = None # Use Optional to allow for null values
8 changes: 8 additions & 0 deletions pygeoweaver/database_management/pgw_execution_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class ExecutionStatus:
DONE = "Done"
FAILED = "Failed"
RUNNING = "Running"
UNKNOWN = "Unknown"
STOPPED = "Stopped"
READY = "Ready"
SKIPPED = "Skipped"
15 changes: 15 additions & 0 deletions pygeoweaver/database_management/pgw_host.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pydantic import BaseModel, Field
from typing import Optional, Set

class Host(BaseModel):
id: str
name: str
ip: str
port: str
username: str
owner: str
type: str
url: str
confidential: bool
envs: Optional[Set[str]] = None

10 changes: 10 additions & 0 deletions pygeoweaver/database_management/pgw_log_activity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from pydantic import BaseModel

class LogActivity(BaseModel):
id: str
operator: str
category: str
objectid: str
objname: str
operation: str

12 changes: 12 additions & 0 deletions pygeoweaver/database_management/pgw_process.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pydantic import BaseModel
from typing import Optional

class GWProcess(BaseModel):
id: str
name: Optional[str]
description: Optional[str]
code: Optional[str]
lang: Optional[str]
owner: Optional[str]
confidential: Optional[bool]

15 changes: 15 additions & 0 deletions pygeoweaver/database_management/pgw_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pydantic import BaseModel
from typing import Optional
from datetime import date
from typing import Optional

class GWUser(BaseModel):
id: str
username: str
password: str
role: Optional[str]
email: Optional[str]
isactive: Optional[bool]
registration_date: Optional[date]
last_login_date: Optional[date]
loggedIn: Optional[bool]
11 changes: 11 additions & 0 deletions pygeoweaver/database_management/pgw_workflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from pydantic import BaseModel
from typing import Optional

class Workflow(BaseModel):
id: str
name: Optional[str]
description: Optional[str]
owner: Optional[str]
confidential: Optional[str]
edges: Optional[str]
nodes: Optional[str]

0 comments on commit 34f9f94

Please sign in to comment.