Fix: Closing stock on update was not working as it was not able to encode/parse creation date and last edit date
This commit is contained in:
parent
b69a38d8e9
commit
b6ef6f79e5
@ -40,10 +40,26 @@ class ClosingStock(BaseModel):
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
json_encoders = {date: lambda v: v.strftime("%d-%b-%Y")}
|
||||
json_encoders = {date: lambda v: v.strftime("%d-%b-%Y"), datetime: lambda v: v.strftime("%d-%b-%Y %H:%M")}
|
||||
|
||||
@validator("date_", pre=True)
|
||||
def parse_date(cls, value):
|
||||
if isinstance(value, date):
|
||||
return value
|
||||
return datetime.strptime(value, "%d-%b-%Y").date()
|
||||
|
||||
@validator("creation_date", pre=True)
|
||||
def parse_creation_date(cls, value):
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, datetime):
|
||||
return value
|
||||
return datetime.strptime(value, "%d-%b-%Y %H:%M")
|
||||
|
||||
@validator("last_edit_date", pre=True)
|
||||
def parse_last_edit_date(cls, value):
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, datetime):
|
||||
return value
|
||||
return datetime.strptime(value, "%d-%b-%Y %H:%M")
|
||||
|
@ -7,15 +7,15 @@ cd "$parent_path" || exit
|
||||
if [ 1 -eq "$#" ]
|
||||
then
|
||||
echo "Version bump to $1"
|
||||
sed --in-place --regexp-extended 's/"([0-9].[0-9].[0-9])"/"'"$1"'"/g' brewman/brewman/__version__.py
|
||||
sed --in-place --regexp-extended 's/"([0-9]*.[0-9].[0-9])"/"'"$1"'"/g' brewman/brewman/__version__.py
|
||||
git add brewman/brewman/__version__.py
|
||||
sed --in-place --regexp-extended 's/version = "([0-9].[0-9].[0-9])"/version = "'"$1"'"/g' brewman/pyproject.toml
|
||||
sed --in-place --regexp-extended 's/version = "([0-9]*.[0-9].[0-9])"/version = "'"$1"'"/g' brewman/pyproject.toml
|
||||
git add brewman/pyproject.toml
|
||||
sed --in-place --regexp-extended 's/version: '\''([0-9].[0-9].[0-9])'\''/version: '\'"$1"\''/g' overlord/src/environments/environment.prod.ts
|
||||
sed --in-place --regexp-extended 's/version: '\''([0-9]*.[0-9].[0-9])'\''/version: '\'"$1"\''/g' overlord/src/environments/environment.prod.ts
|
||||
git add overlord/src/environments/environment.prod.ts
|
||||
sed --in-place --regexp-extended 's/version: '\''([0-9].[0-9].[0-9])'\''/version: '\'"$1"\''/g' overlord/src/environments/environment.ts
|
||||
sed --in-place --regexp-extended 's/version: '\''([0-9]*.[0-9].[0-9])'\''/version: '\'"$1"\''/g' overlord/src/environments/environment.ts
|
||||
git add overlord/src/environments/environment.ts
|
||||
sed --in-place --regexp-extended 's/"version": "([0-9].[0-9].[0-9])"/"version": "'"$1"'"/g' overlord/package.json
|
||||
sed --in-place --regexp-extended 's/"version": "([0-9]*.[0-9].[0-9])"/"version": "'"$1"'"/g' overlord/package.json
|
||||
git add overlord/package.json
|
||||
git commit -m "Version Bump v$1"
|
||||
git tag "v$1"
|
||||
|
Loading…
Reference in New Issue
Block a user