122 lines
2.8 KiB
JavaScript
122 lines
2.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.GiftContributionSchema = exports.GiftContribution = exports.GiftSchema = exports.Gift = void 0;
|
|
const core_1 = require("@mikro-orm/core");
|
|
const uuid_1 = require("uuid");
|
|
const base_entity_1 = require("../../core/entities/base.entity");
|
|
class Gift extends base_entity_1.BaseEntity {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.status = 'pending';
|
|
}
|
|
}
|
|
exports.Gift = Gift;
|
|
exports.GiftSchema = new core_1.EntitySchema({
|
|
class: Gift,
|
|
tableName: 'gifts',
|
|
properties: {
|
|
id: {
|
|
type: 'uuid',
|
|
primary: true,
|
|
default: (0, uuid_1.v4)(),
|
|
},
|
|
tenantId: {
|
|
type: 'string',
|
|
},
|
|
metadata: {
|
|
type: 'json',
|
|
nullable: true,
|
|
},
|
|
createdAt: {
|
|
type: 'date',
|
|
default: new Date(),
|
|
},
|
|
updatedAt: {
|
|
type: 'date',
|
|
default: new Date(),
|
|
},
|
|
name: {
|
|
type: 'string',
|
|
},
|
|
description: {
|
|
type: 'string',
|
|
nullable: true,
|
|
},
|
|
imageUrl: {
|
|
type: 'string',
|
|
nullable: true,
|
|
},
|
|
price: {
|
|
type: 'float',
|
|
nullable: true,
|
|
},
|
|
experience: {
|
|
type: 'boolean',
|
|
nullable: true,
|
|
},
|
|
status: {
|
|
type: 'string',
|
|
default: 'pending',
|
|
},
|
|
ownerId: {
|
|
type: 'string',
|
|
nullable: true,
|
|
},
|
|
},
|
|
});
|
|
class GiftContribution extends base_entity_1.BaseEntity {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.type = 'individual';
|
|
this.status = 'pending';
|
|
}
|
|
}
|
|
exports.GiftContribution = GiftContribution;
|
|
exports.GiftContributionSchema = new core_1.EntitySchema({
|
|
class: GiftContribution,
|
|
tableName: 'gift_contributions',
|
|
properties: {
|
|
id: {
|
|
type: 'uuid',
|
|
primary: true,
|
|
default: (0, uuid_1.v4)(),
|
|
},
|
|
tenantId: {
|
|
type: 'string',
|
|
},
|
|
metadata: {
|
|
type: 'json',
|
|
nullable: true,
|
|
},
|
|
createdAt: {
|
|
type: 'date',
|
|
default: new Date(),
|
|
},
|
|
updatedAt: {
|
|
type: 'date',
|
|
default: new Date(),
|
|
},
|
|
giftId: {
|
|
type: 'uuid',
|
|
},
|
|
contributorName: {
|
|
type: 'string',
|
|
},
|
|
contributorEmail: {
|
|
type: 'string',
|
|
nullable: true,
|
|
},
|
|
amount: {
|
|
type: 'float',
|
|
},
|
|
type: {
|
|
type: 'string',
|
|
default: 'individual',
|
|
},
|
|
status: {
|
|
type: 'string',
|
|
default: 'pending',
|
|
},
|
|
},
|
|
});
|