Admins basket details
This commit is contained in:
parent
c1f229f805
commit
b00bf1f9f9
3 changed files with 94 additions and 47 deletions
|
@ -8,7 +8,7 @@ import pandas as pd
|
|||
from gisaf.models.models_base import Model
|
||||
from gisaf.models.survey import Surveyor, Equipment
|
||||
from gisaf.models.project import Project
|
||||
from gisaf.models.metadata import gisaf_admin
|
||||
from gisaf.models.metadata import gisaf_admin, gisaf_survey
|
||||
|
||||
|
||||
re_file_import_record_date_expr = '^(\S+)-(\d\d\d\d)-(\d\d)-(\d\d).*$'
|
||||
|
@ -38,7 +38,7 @@ def get_file_import_date(record) -> date:
|
|||
year=int(fname_search.group(2)))
|
||||
|
||||
|
||||
class FileImport(Model):
|
||||
class FileImport(Model, table=True):
|
||||
"""
|
||||
Files to import or imported in the DB.
|
||||
Give either url or path.
|
||||
|
@ -58,13 +58,13 @@ class FileImport(Model):
|
|||
status: str
|
||||
store: str
|
||||
basket: str
|
||||
project_id: int = Field(foreign_key='project.id')
|
||||
project_id: int = Field(foreign_key=gisaf_admin.table('project.id'))
|
||||
project: Project = Relationship()
|
||||
# ALTER TABLE gisaf_admin.file_import add column project_id INT REFERENCES gisaf_admin.project;
|
||||
surveyor_id: int = Field(foreign_key='surveyor.id')
|
||||
surveyor_id: int = Field(foreign_key=gisaf_survey.table('surveyor.id'))
|
||||
surveyor: Surveyor = Relationship()
|
||||
# ALTER TABLE gisaf_admin.file_import add column surveyor_id INT REFERENCES gisaf_survey.surveyor;
|
||||
equipment_id: int = Field(foreign_key='equipment.id')
|
||||
equipment_id: int = Field(foreign_key=gisaf_survey.table('equipment.id'))
|
||||
equipment: Equipment = Relationship()
|
||||
# ALTER TABLE gisaf_admin.file_import add column equipment_id INT REFERENCES gisaf_survey.equipment;
|
||||
|
||||
|
@ -112,7 +112,7 @@ class FileImport(Model):
|
|||
# return os_path.exists(self.get_absolute_path())
|
||||
|
||||
|
||||
class FeatureImportData(Model):
|
||||
class FeatureImportData(Model, table=True):
|
||||
"""
|
||||
Keep track of imported data, typically from shapefiles
|
||||
"""
|
||||
|
@ -159,4 +159,27 @@ class Basket(BasketNameOnly):
|
|||
class BasketImportResult(BaseModel):
|
||||
time: datetime
|
||||
message: str
|
||||
details: str
|
||||
details: str
|
||||
|
||||
class AdminBasketFile(BaseModel):
|
||||
id: int
|
||||
dir: str
|
||||
name: str
|
||||
url: str
|
||||
md5: str
|
||||
time: datetime
|
||||
comment: str
|
||||
status: str
|
||||
store: str
|
||||
project: str
|
||||
surveyor: str
|
||||
equipment: str
|
||||
import_result: str
|
||||
|
||||
|
||||
class AdminBasket(BaseModel):
|
||||
name: str
|
||||
files: list[FileImport]
|
||||
columns: list[str]
|
||||
uploadFields: list[str]
|
||||
projects: list[str] = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue