P5-6517 add market resource (#32)

This commit is contained in:
Martin Carlsson
2021-01-12 15:09:48 +01:00
committed by GitHub
parent 1f016ee0c8
commit bd1b0e642b
5 changed files with 86 additions and 1 deletions
+11
View File
@@ -2,6 +2,7 @@
from api.extensions import db
from .product import Currencies
from sqlalchemy.orm import validates
class Market(db.Model):
@@ -10,6 +11,16 @@ class Market(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255))
@validates("name")
def validate_name(self, key, value):
raise ValueError("Name can not be modified")
def to_json(self):
return {
"id": self.id,
"name": self.name,
}
class PriceAdjustments(db.Model):