Project: Mall App Client: Maiora
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

31 Zeilen
850 B

  1. export class Offer {
  2. name: string;
  3. description: string;
  4. coupon_code: string;
  5. constructor(initializationObject: any) {
  6. // Check if object has the required fields
  7. if (!initializationObject.hasOwnProperty('name')) {
  8. throw new Error('The offer needs a name');
  9. }
  10. if (!initializationObject.hasOwnProperty('description')) {
  11. throw new Error('The offer needs a description');
  12. }
  13. if (!initializationObject.hasOwnProperty('coupon_code')) {
  14. throw new Error('The offer needs a coupon_code');
  15. }
  16. this.name = initializationObject.name;
  17. this.description = initializationObject.description;
  18. this.coupon_code = initializationObject.coupon_code;
  19. }
  20. }
  21. export type OfferCollection = {
  22. name: string,
  23. offers: Array<Offer>,
  24. };