Commit 33d280d4 authored by Tsvetelina Yordanova's avatar Tsvetelina Yordanova
Browse files

feat: #60 promotion title translation

parent 6f422bf3
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.6",
	"version": "0.3.11",
	"homepage": "https://ever.co",
	"repository": {
		"type": "git",
+18 −18
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';
import {
	IPromotion,
	IPromotionCreateObject,
	IPromotionTitle,
	IPromotionDescription,
} from '../interfaces/IPromotion';

/**
 *
@@ -13,23 +18,19 @@ import { IPromotion, IPromotionCreateObject } from '../interfaces/IPromotion';
@Entity({ name: 'promotions' })
class Promotion extends DBObject<IPromotion, IPromotionCreateObject>
	implements IPromotion {
	//tstodo

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

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

	/**
	 * @type {boolean}
@@ -63,13 +64,12 @@ class Promotion extends DBObject<IPromotion, IPromotionCreateObject>
	@Column()
	image: string;

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

	/**
	 * @type {number}
+9 −11
Original line number Diff line number Diff line
@@ -6,18 +6,18 @@ export interface IPromotionCreateObject extends DBCreateObject {
	/**
	 * Promotion title locale
	 *
	 * @type {string}
	 * @type {IPromotionTitle[]}
	 * @memberof IPromotionCreateObject
	 */
	title: string;
	title: IPromotionTitle[];

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

	/**
	 *
@@ -46,12 +46,11 @@ export interface IPromotionCreateObject extends DBCreateObject {
	 */
	image: string;

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

	/**
	 * @type {number}
@@ -64,6 +63,5 @@ 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.5",
	"version": "0.3.9",
	"homepage": "https://ever.co",
	"repository": {
		"type": "git",
+20 −7
Original line number Diff line number Diff line
type Promotion {
	_id: String
	title: String
	description: String
	title: [TranslateType]
	description: [TranslateType]
	active: Boolean
	activeFrom: Date
	activeTo: Date
	image: String
	# product: Product
	product: Product
	purchasesCount: Int
}

type TranslateType {
	locale: String!
	value: String!
}

type Product {
	_id: String!
}

input PromotionCreateInput {
	title: String!
	description: String
	title: [TranslateInput]
	description: [TranslateInput]
	active: Boolean
	activeFrom: Date
	activeTo: Date
	image: String
	# tstodo
	# product: String
	product: String
	purchasesCount: Int
}

input TranslateInput {
	locale: String!
	value: String!
}

type Query {
	promotions: [Promotion]
}
Loading