Commit 4ead7d73 authored by Jo Sama's avatar Jo Sama 😱
Browse files

Add support to fetch partial arbeidsordre

parent b0d1ce2d
Pipeline #48770 failed with stage
in 2 minutes and 16 seconds
......@@ -533,6 +533,30 @@ class UBWClient:
r = self.get(url, headers=headers)
return [models.Arbeidsordre.from_dict(x) for x in r]
# TODO: Extend get_arbeidsordrer to support the same partial model as the following function
def get_partial_arbeidsordrer(self, company_id: str) -> typing.List[models.PartialArbeidsordre]:
url = self.urls.get_arbeidsordre(company_id)
headers = self.config.rest.endpoints.begreper.headers
r = self.get(url,
headers=headers,
params={
'select': ','.join(
['companyId',
'workOrderId',
'dateFrom',
'dateTo',
'periodFrom',
'periodTo',
'status',
'projectId',
'workOrderName',
'costCentre',
'projectManagerId',
'category1',
'lastUpdated(updatedAt,updatedBy)'])})
return [models.PartialArbeidsordre.from_dict(x) for x in r]
def get_perioder(
self,
company_id: str,
......
......@@ -631,6 +631,26 @@ class CustomerInformation(BaseModel):
allow_population_by_field_name = True
class PartialArbeidsordre(BaseModel):
company_id: str
work_order_id: str
date_from: str
date_to: str
period_from: str
period_to: str
status: str
project_id: str
work_order_name: str
cost_centre: str
project_manager_id: str
category1: str
last_updated: UpdatedInfo
class Config:
alias_generator = to_lower_camel
allow_population_by_field_name = True
class Arbeidsordre(BaseModel):
company_id: str
work_order_id: str
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment