tibi-docs/api/collections/rating.yml
2024-03-11 17:26:10 +00:00

301 lines
8.7 KiB
YAML

name: rating
meta:
label: { de: "Bewertungen", en: "Ratings" }
muiIcon: reviews
views:
- type: simpleList
mediaQuery: "max-width: 600px"
primaryText: order
- type: table
columns:
- source: orderId
filter: true
- source: productId
filter: true
- source: rating
filter: true
- source: status
filter: true
permissions:
public:
methods:
get: true
post: true
put: true
delete: false
user:
methods:
get: true
post: true
put: true
delete: false
rating:
methods:
get: true
post: true
put: true
delete: false
"token:${IMPORT_TOKEN}":
methods:
get: true
post: true
put: true
delete: true
hooks:
delete:
delete:
type: javascript
file: hooks/rating/delete_delete.js
return:
type: javascript
file: hooks/rating/delete_return.js
get:
read:
type: javascript
file: hooks/rating/get_read.js
post:
validate:
type: javascript
file: hooks/rating/post_validate.js
create:
type: javascript
file: hooks/rating/post_create.js
return:
file: hooks/rating/post_return.js
type: javascript
put:
validate:
type: javascript
file: hooks/rating/put_validate.js
update:
type: javascript
file: hooks/rating/put_update.js
return:
file: hooks/rating/put_return.js
type: javascript
fields:
- name: bigCommerceOrderId
index: [single]
type: string
meta:
label: { de: Bestellung, en: "Order" }
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
- name: bigCommerceProductRatingId
index: [single]
type: string
meta:
label: { de: "Produktbewertung - BigCommerce ID", en: "Product Rating - BigCommerce ID" }
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
- name: productId
index: [single]
type: string
meta:
label: { de: "Produkt", en: "Product" }
widget: foreignKey
foreign:
collection: bigCommerceProducts
subNavigation: 0
id: id
render:
defaultCollectionViews: true
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
validator:
required: true
- name: author
type: string
validator:
required: true
meta:
label: { de: "Autor", en: "Author" }
defaultValue: Anonym
- name: rating
index: [single]
type: object
meta:
label: { de: "Bewertung", en: "Rating" }
subFields:
- name: length
type: number
meta:
label: { de: "Länge", en: "Length" }
helperText: { de: "1 - Besonders Kurz; 5 - Besonders Lang", en: "1 - Very Short; 5 - Very Long" }
defaultValue: 5
validator:
eval: |
(function () {
return $this >= 0 && $this <= 5;
})()
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
- name: fit
type: number
meta:
label: { de: "Passform", en: "Fit" }
helperText: { de: "1 - Sehr Eng; 5 - Sehr Weit", en: "1 - Very Tight; 5 - Very Wide" }
defaultValue: 5
validator:
eval: |
(function () {
return $this >= 0 && $this <= 5;
})()
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
- name: quality
type: number
meta:
label: { de: "Qualität", en: "Quality" }
helperText: { de: "1 - Schlecht; 5 - Sehr Gut", en: "1 - Bad; 5 - Very Good" }
defaultValue: 5
validator:
eval: |
(function () {
return $this >= 0 && $this <= 5;
})()
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
- name: priceQualityRatio
type: number
meta:
label: { de: "Preis-Leistungs-Verhältnis", en: "Price-Quality Ratio" }
helperText: { de: "1 - Schlecht; 5 - Sehr Gut", en: "1 - Bad; 5 - Very Good" }
defaultValue: 5
validator:
eval: |
(function () {
return $this >= 0 && $this <= 5;
})()
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
- name: comfort
type: number
meta:
label: { de: "Komfort", en: "Comfort" }
helperText: { de: "1 - Unbequem; 5 - Sehr Bequem", en: "1 - Uncomfortable; 5 - Very Comfortable" }
defaultValue: 5
validator:
eval: |
(function () {
return $this >= 0 && $this <= 5;
})()
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
- name: overall
type: number
meta:
label: { de: "Gesamt", en: "Overall" }
helperText: { de: "1 - Schlecht; 5 - Sehr Gut", en: "1 - Bad; 5 - Very Good" }
defaultValue: 5
validator:
eval: |
(function () {
return $this >= 0 && $this <= 5;
})()
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-4"
- name: comment
type: string
meta:
widget: richtext
label: { de: "Kommentar", en: "Comment" }
inputProps:
multiline: true
- name: review_date
type: date
validator:
eval: |
(function () {
return (new Date($this) !== "Invalid Date") && !isNaN(new Date($this));
})()
meta:
label: { de: "Erstellungsdatum", en: "Creation date" }
defaultValue:
eval: new Date()
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-6"
- name: status
type: string
index: [single]
validator:
eval: (["pending", "approved", "rejected"].includes($this))
meta:
label: Status
widget: "select"
defaultValue: pending
choices:
- name: { de: wartend, en: pending }
id: pending
- name: { de: bestätigt, en: approved }
id: approved
- name: { de: abgelehnt, en: rejected }
id: rejected
containerProps:
layout:
size:
default: "col-6"
small: "col-12"
large: "col-6"