Commit f6df9530 authored by Tsvetelina Yordanova's avatar Tsvetelina Yordanova
Browse files

feat: #60-start-promotions

parent 8275a5d0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
	"name": "@ever-platform/common",
	"description": "Ever Platform Shared Core",
	"license": "AGPL-3.0",
	"version": "0.3.1",
	"version": "0.3.6",
	"homepage": "https://ever.co",
	"repository": {
		"type": "git",
+82 −0
Original line number Diff line number Diff line
import { DBObject, ModelName, Types, Schema } from '@pyro/db';
import { Entity, Column } from 'typeorm';
import Product from './Product';
import { IPromotion, IPromotionCreateObject } from '../interfaces/IPromotion';

/**
 *
 * @class Promotion
 * @extends {DBObject<IPromotion, IPromotionCreateObject>}
 * @implements {IPromotion}
 */
@ModelName('Promotion')
@Entity({ name: 'promotions' })
class Promotion extends DBObject<IPromotion, IPromotionCreateObject>
	implements IPromotion {
	//tstodo

	/**
	 * @type {string}
	 * @memberof Promotion
	 */
	@Schema({ type: String, required: false })
	@Column()
	title: string;

	/**
	 * @type {string}
	 * @memberof Promotion
	 */
	@Schema({ type: Date, required: false })
	@Column()
	description: string;

	/**
	 * @type {boolean}
	 * @memberof Promotion
	 */
	@Types.Boolean(true)
	@Column()
	active: boolean;

	/**
	 * @type {Date}
	 * @memberof Promotion
	 */
	@Schema({ type: Date, required: true })
	@Column()
	activeFrom: Date;

	/**
	 * @type {Date}
	 * @memberof Promotion
	 */
	@Schema({ type: Date, required: false })
	@Column()
	activeTo: Date;

	/**
	 * @type {string}
	 * @memberof Promotion
	 */
	@Schema({ type: String, required: false })
	@Column()
	image: string;

	/**
	 * @type {Product}
	 * @memberof Promotion
	 */
	@Types.Ref(Product)
	product: Product;

	/**
	 * @type {number}
	 * @memberof Promotion
	 */
	@Types.Number()
	@Column()
	purchasesCount: number;
}

export default Promotion;
+1 −0
Original line number Diff line number Diff line
@@ -13,3 +13,4 @@ export * from './User';
export * from './UserOrder';
export * from './Warehouse';
export * from './WarehouseProduct';
export * from './Promotion';
+68 −0
Original line number Diff line number Diff line
import { ILocaleMember } from './ILocale';
import Product from '../entities/Product';
import { DBRawObject, PyroObjectId, DBCreateObject } from '@pyro/db';

export interface IPromotionCreateObject extends DBCreateObject {
	/**
	 * Promotion title locale
	 *
	 * @type {string}
	 * @memberof IPromotionCreateObject
	 */
	title: string;

	/**
	 * Promotion description locale
	 *
	 * @type {string}
	 * @memberof IPromotionCreateObject
	 */
	description: string;

	/**
	 *
	 * @type {boolean}
	 * @memberof IPromotionCreateObject
	 */
	active: boolean;

	/**
	 * @type {Date}
	 * @memberof IPromotionCreateObject
	 */
	activeFrom: Date;

	/**
	 * @type {Date}
	 * @memberof IPromotionCreateObject
	 */
	activeTo: Date;

	/**
	 * Url to Promotion picture/photo
	 *
	 * @type {string}
	 * @memberof IPromotionCreateObject
	 */
	image: string;

	/**
	 * @type {Product}
	 * @memberof IPromotionCreateObject
	 */
	product: Product;

	/**
	 * @type {number}
	 * @memberof IPromotionCreateObject
	 */
	purchasesCount: number;
}

export interface IPromotion extends IPromotionCreateObject, DBRawObject {
	_id: PyroObjectId;
}

//tstodo ^^
export interface IPromotionDescription extends ILocaleMember {}
export interface IPromotionTitle extends ILocaleMember {}
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
	"name": "@ever-platform/core",
	"description": "Ever Platform Headless Framework",
	"license": "AGPL-3.0",
	"version": "0.3.1",
	"version": "0.3.5",
	"homepage": "https://ever.co",
	"repository": {
		"type": "git",
Loading