Unverified Commit c99a971d authored by Ruslan Konviser's avatar Ruslan Konviser Committed by GitHub
Browse files

Merge pull request #1179 from ever-co/feat/#60-popup-promotions

Feat/#60 popup promotions
parents 429a9465 985cc062
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.10",
	"version": "0.3.11",
	"homepage": "https://ever.co",
	"repository": {
		"type": "git",
+87 −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,
	IPromotionTitle,
	IPromotionDescription,
} from '../interfaces/IPromotion';

/**
 *
 * @class Promotion
 * @extends {DBObject<IPromotion, IPromotionCreateObject>}
 * @implements {IPromotion}
 */
@ModelName('Promotion')
@Entity({ name: 'promotions' })
class Promotion extends DBObject<IPromotion, IPromotionCreateObject>
	implements IPromotion {
	/**
	 * @type {IPromotionTitle[]}
	 * @memberof Promotion
	 */
	@Schema({ type: Array, required: false })
	title: IPromotionTitle[];

	/**
	 * @type {IPromotionDescription[]}
	 * @memberof Promotion
	 */
	@Schema({ type: Array, required: false })
	description: IPromotionDescription[];

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

	/**
	 * @type {Date}
	 * @memberof Promotion
	 */
	@Schema({ type: Date, required: false })
	@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;

	@Types.Boolean(false)
	@Column()
	isDeleted: boolean;
}

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';
+67 −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 {IPromotionTitle[]}
	 * @memberof IPromotionCreateObject
	 */
	title: IPromotionTitle[];

	/**
	 * Promotion description locale
	 *
	 * @type {IPromotionDescription[]}
	 * @memberof IPromotionCreateObject
	 */
	description: IPromotionDescription[];

	/**
	 *
	 * @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;
}

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.8",
	"version": "0.3.9",
	"homepage": "https://ever.co",
	"repository": {
		"type": "git",
Loading