@brimble/models 3.8.84 → 3.8.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coupon-redemption.d.ts +9 -0
- package/dist/coupon-redemption.js +44 -0
- package/dist/coupon.d.ts +9 -0
- package/dist/coupon.js +35 -0
- package/dist/domain/index.js +4 -0
- package/dist/drain.js +3 -2
- package/dist/enum/index.d.ts +12 -0
- package/dist/enum/index.js +16 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +10 -3
- package/dist/project-drain-subscription.js +1 -2
- package/dist/types/coupon-redemption.d.ts +22 -0
- package/dist/types/coupon-redemption.js +2 -0
- package/dist/types/coupon.d.ts +24 -0
- package/dist/types/coupon.js +2 -0
- package/dist/types/domain/index.d.ts +1 -0
- package/dist/types/drain.d.ts +2 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/project-drain-subscription.d.ts +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICouponRedemption } from "./types/coupon-redemption";
|
|
2
|
+
declare const _default: import("mongoose").Model<ICouponRedemption, {}, {}, {}, import("mongoose").Document<unknown, {}, ICouponRedemption, {}, import("mongoose").DefaultSchemaOptions> & ICouponRedemption & Required<{
|
|
3
|
+
_id: import("mongoose").Types.ObjectId;
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, ICouponRedemption>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const couponRedemptionSchema = new mongoose_1.Schema({
|
|
6
|
+
coupon_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Coupon", required: true, index: true },
|
|
7
|
+
code: { type: String, required: true },
|
|
8
|
+
user_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "User", required: true, index: true },
|
|
9
|
+
team_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Team", default: null },
|
|
10
|
+
scope: {
|
|
11
|
+
type: String,
|
|
12
|
+
enum: Object.values(enum_1.CouponScope),
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
domain_name: { type: String, default: null },
|
|
16
|
+
duration_years: { type: Number, default: null },
|
|
17
|
+
idempotency_key: { type: String },
|
|
18
|
+
transaction_reference: { type: String },
|
|
19
|
+
original_amount: { type: Number, required: true },
|
|
20
|
+
discount_amount: { type: Number, required: true },
|
|
21
|
+
final_amount: { type: Number, required: true },
|
|
22
|
+
status: {
|
|
23
|
+
type: String,
|
|
24
|
+
enum: Object.values(enum_1.CouponRedemptionStatus),
|
|
25
|
+
default: enum_1.CouponRedemptionStatus.Reserved,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
reserved_at: { type: Date, required: true },
|
|
29
|
+
applied_at: { type: Date, default: null },
|
|
30
|
+
reversed_at: { type: Date, default: null },
|
|
31
|
+
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "coupon_redemptions" });
|
|
32
|
+
couponRedemptionSchema.index({ coupon_id: 1, user_id: 1, status: 1 });
|
|
33
|
+
couponRedemptionSchema.index({ coupon_id: 1, transaction_reference: 1 }, {
|
|
34
|
+
unique: true,
|
|
35
|
+
partialFilterExpression: {
|
|
36
|
+
transaction_reference: { $exists: true },
|
|
37
|
+
status: enum_1.CouponRedemptionStatus.Applied,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
couponRedemptionSchema.index({ coupon_id: 1, user_id: 1, idempotency_key: 1 }, {
|
|
41
|
+
unique: true,
|
|
42
|
+
partialFilterExpression: { idempotency_key: { $exists: true } },
|
|
43
|
+
});
|
|
44
|
+
exports.default = (0, mongoose_1.model)("CouponRedemption", couponRedemptionSchema);
|
package/dist/coupon.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICoupon } from "./types/coupon";
|
|
2
|
+
declare const _default: import("mongoose").Model<ICoupon, {}, {}, {}, import("mongoose").Document<unknown, {}, ICoupon, {}, import("mongoose").DefaultSchemaOptions> & ICoupon & Required<{
|
|
3
|
+
_id: import("mongoose").Types.ObjectId;
|
|
4
|
+
}> & {
|
|
5
|
+
__v: number;
|
|
6
|
+
} & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, any, ICoupon>;
|
|
9
|
+
export default _default;
|
package/dist/coupon.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const couponSchema = new mongoose_1.Schema({
|
|
6
|
+
code: { type: String, required: true, unique: true, uppercase: true, trim: true },
|
|
7
|
+
description: { type: String, default: null },
|
|
8
|
+
scope: {
|
|
9
|
+
type: String,
|
|
10
|
+
enum: Object.values(enum_1.CouponScope),
|
|
11
|
+
default: enum_1.CouponScope.DomainPurchase,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
discount_type: {
|
|
15
|
+
type: String,
|
|
16
|
+
enum: Object.values(enum_1.CouponDiscountType),
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
discount_value: { type: Number, required: true, min: 0 },
|
|
20
|
+
currency: { type: String, default: "USD" },
|
|
21
|
+
max_redemptions: { type: Number, default: null },
|
|
22
|
+
max_redemptions_per_user: { type: Number, default: 1 },
|
|
23
|
+
redemption_count: { type: Number, default: 0 },
|
|
24
|
+
min_purchase_amount: { type: Number, default: null },
|
|
25
|
+
allowed_tlds: { type: [String], default: [] },
|
|
26
|
+
max_duration_years: { type: Number, default: null },
|
|
27
|
+
allow_below_cost: { type: Boolean, default: false },
|
|
28
|
+
starts_at: { type: Date, default: null },
|
|
29
|
+
expires_at: { type: Date, default: null },
|
|
30
|
+
enabled: { type: Boolean, default: true },
|
|
31
|
+
created_by: { type: String, default: null },
|
|
32
|
+
disabled_at: { type: Date, default: null },
|
|
33
|
+
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" }, collection: "coupons" });
|
|
34
|
+
couponSchema.index({ enabled: 1, expires_at: 1 });
|
|
35
|
+
exports.default = (0, mongoose_1.model)("Coupon", couponSchema);
|
package/dist/domain/index.js
CHANGED
package/dist/drain.js
CHANGED
|
@@ -14,6 +14,8 @@ const DrainSchema = new mongoose_1.Schema({
|
|
|
14
14
|
region: { type: String },
|
|
15
15
|
endpoint: { type: String },
|
|
16
16
|
keyPrefix: { type: String, default: "" },
|
|
17
|
+
storageBucketId: { type: mongoose_1.Schema.Types.ObjectId, ref: "StorageBucket", default: null },
|
|
18
|
+
storageCredentialId: { type: mongoose_1.Schema.Types.ObjectId, ref: "StorageCredential", default: null },
|
|
17
19
|
},
|
|
18
20
|
secretsRef: { type: String, required: true },
|
|
19
21
|
sources: [{ type: String, enum: Object.values(enum_1.LogSource) }],
|
|
@@ -26,7 +28,6 @@ const DrainSchema = new mongoose_1.Schema({
|
|
|
26
28
|
statusReason: { type: String, default: null },
|
|
27
29
|
failingSince: { type: Date, default: null },
|
|
28
30
|
disabledAt: { type: Date, default: null },
|
|
29
|
-
deletedAt: { type: Date, default: null },
|
|
30
31
|
}, { timestamps: true });
|
|
31
|
-
DrainSchema.index({ user_id: 1, team: 1
|
|
32
|
+
DrainSchema.index({ user_id: 1, team: 1 });
|
|
32
33
|
exports.default = (0, mongoose_1.model)("Drain", DrainSchema);
|
package/dist/enum/index.d.ts
CHANGED
|
@@ -435,3 +435,15 @@ export declare enum WorkbenchMode {
|
|
|
435
435
|
}
|
|
436
436
|
export declare const QUEST_CLAIM_REQUIREMENTS: QuestRequirementType[];
|
|
437
437
|
export declare const QUEST_TARGETLESS_REQUIREMENTS: QuestRequirementType[];
|
|
438
|
+
export declare enum CouponDiscountType {
|
|
439
|
+
Percentage = "percentage",
|
|
440
|
+
Fixed = "fixed"
|
|
441
|
+
}
|
|
442
|
+
export declare enum CouponScope {
|
|
443
|
+
DomainPurchase = "domain_purchase"
|
|
444
|
+
}
|
|
445
|
+
export declare enum CouponRedemptionStatus {
|
|
446
|
+
Reserved = "reserved",
|
|
447
|
+
Applied = "applied",
|
|
448
|
+
Reversed = "reversed"
|
|
449
|
+
}
|
package/dist/enum/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_SOURCE = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_CHANGE_SOURCE = exports.DNS_CHANGE_TYPE = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.DrainEventType = exports.LogSource = exports.DrainStatus = exports.DrainType = exports.AlertEventStatus = exports.AlertChannelMode = exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.PROJECT_DISABLED_BY = exports.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
|
|
4
|
-
exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.WorkbenchMode = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = void 0;
|
|
4
|
+
exports.CouponRedemptionStatus = exports.CouponScope = exports.CouponDiscountType = exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.WorkbenchMode = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = void 0;
|
|
5
5
|
var GIT_TYPE;
|
|
6
6
|
(function (GIT_TYPE) {
|
|
7
7
|
GIT_TYPE["GITHUB"] = "GITHUB";
|
|
@@ -531,3 +531,18 @@ exports.QUEST_TARGETLESS_REQUIREMENTS = [
|
|
|
531
531
|
QuestRequirementType.PaidPlan,
|
|
532
532
|
QuestRequirementType.PaymentMethod,
|
|
533
533
|
];
|
|
534
|
+
var CouponDiscountType;
|
|
535
|
+
(function (CouponDiscountType) {
|
|
536
|
+
CouponDiscountType["Percentage"] = "percentage";
|
|
537
|
+
CouponDiscountType["Fixed"] = "fixed";
|
|
538
|
+
})(CouponDiscountType || (exports.CouponDiscountType = CouponDiscountType = {}));
|
|
539
|
+
var CouponScope;
|
|
540
|
+
(function (CouponScope) {
|
|
541
|
+
CouponScope["DomainPurchase"] = "domain_purchase";
|
|
542
|
+
})(CouponScope || (exports.CouponScope = CouponScope = {}));
|
|
543
|
+
var CouponRedemptionStatus;
|
|
544
|
+
(function (CouponRedemptionStatus) {
|
|
545
|
+
CouponRedemptionStatus["Reserved"] = "reserved";
|
|
546
|
+
CouponRedemptionStatus["Applied"] = "applied";
|
|
547
|
+
CouponRedemptionStatus["Reversed"] = "reversed";
|
|
548
|
+
})(CouponRedemptionStatus || (exports.CouponRedemptionStatus = CouponRedemptionStatus = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -78,8 +78,10 @@ export { default as StreakMilestone } from "./streak-milestone";
|
|
|
78
78
|
export { default as QuestCampaign } from "./quest-campaign";
|
|
79
79
|
export { default as QuestParticipation } from "./quest-participation";
|
|
80
80
|
export { default as QuestRewardIssuance } from "./quest-reward-issuance";
|
|
81
|
-
export {
|
|
82
|
-
export {
|
|
81
|
+
export { default as Coupon } from "./coupon";
|
|
82
|
+
export { default as CouponRedemption } from "./coupon-redemption";
|
|
83
|
+
export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IProjectNetworkSettings, IRatelimit, RatelimitConfig, RateLimitZone, RateLimitMatcher, DistributedRateLimitConfig, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IDnsChangeLog, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IDomainTransfer, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, IProjectEnvironment, IEnvironmentVariable, IActivityLog, IAlertRule, IAlertRuleState, IAlertEvent, IAlertNotificationResult, IDrain, IProjectDrainSubscription, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxActivity, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, IVolumeUsageSegment, IVolumeUsageSegmentCosts, IObjectStorageUsageSegment, IObjectStorageUsageSegmentCosts, IObjectStorageUsageUnitsSummary, IIdempotencyRecord, IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition, IStreak, IStreakMilestoneRef, IStreakEvent, IStreakDay, IStreakMilestone, IQuestCampaign, IQuestCriterion, IQuestRequirement, IQuestReward, IQuestParticipation, IQuestCriterionProgress, IQuestRewardIssuance, IQuestIssuedReward, ICoupon, ICouponRedemption, } from "./types";
|
|
84
|
+
export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, AlertMetric, AlertCondition, AlertRuleState, AlertChannelMode, AlertEventStatus, DrainType, DrainStatus, LogSource, DrainEventType, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, DNS_CHANGE_TYPE, DNS_CHANGE_SOURCE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, SCALING_SOURCE, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, PROJECT_DISABLED_BY, SERVER_PROTOCOL, FrameworkApplicationType, DomainRenewalStatus, DomainTransferProvider, DomainTransferDirection, DomainTransferStatus, NomadDeploymentStatus, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE, SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON, SANDBOX_EGRESS_MODE, SANDBOX_SNAPSHOT_STATUS, StorageBucketStatus, StorageUploadStatus, StorageTokenStatus, StorageCredentialRole, StorageCredentialStatus, StorageMigrationStatus, XFrameOptions, XContentTypeOptions, XRobotsTag, QualifyingActionType, MilestoneType, QUEST_COUNTABLE_MILESTONES, ACTION_TO_MILESTONE, EligibilityType, RewardType, QuestRewardStatus, QuestCriterionType, QuestEntity, QuestRequirementType, QUEST_CLAIM_REQUIREMENTS, QUEST_TARGETLESS_REQUIREMENTS, WorkbenchMode, CouponDiscountType, CouponScope, CouponRedemptionStatus } from "./enum";
|
|
83
85
|
import mongoose from "mongoose";
|
|
84
86
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
85
87
|
export declare const db: mongoose.Connection;
|
package/dist/index.js
CHANGED
|
@@ -13,9 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Provider = exports.Intention = exports.WebhookSetting = exports.WebhookEvent = exports.WebhookCategory = exports.DomainTransfer = exports.DomainRenewal = exports.LoadBalancerPort = exports.Settings = exports.Framework = exports.Volume = exports.Region = exports.ComputeChange = exports.AutoScalingGroup = exports.PlanConfiguration = exports.Liscense = exports.Job = exports.DbImage = exports.Wallet = exports.Server = exports.Card = exports.Subscription = exports.Log = exports.Role = exports.MemberPermission = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.DnsChangeLog = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.Ratelimit = exports.ProjectNetworkSettings = exports.ProjectConnection = exports.Preview = exports.ProjectAnalytics = exports.DeletedProject = exports.Project = exports.User = void 0;
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.WorkbenchMode = exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = void 0;
|
|
16
|
+
exports.AlertRuleState = exports.AlertCondition = exports.AlertMetric = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.CouponRedemption = exports.Coupon = exports.QuestRewardIssuance = exports.QuestParticipation = exports.QuestCampaign = exports.StreakMilestone = exports.StreakDay = exports.StreakEvent = exports.Streak = exports.StorageMigration = exports.StorageCredential = exports.StorageToken = exports.StorageUpload = exports.StorageObject = exports.StorageBucket = exports.IdempotencyRecord = exports.ObjectStorageUsageSegment = exports.VolumeUsageSegment = exports.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.SandboxSnapshot = exports.SandboxImage = exports.SandboxActivity = exports.Sandbox = exports.OwnershipTransfer = exports.ProjectDrainSubscription = exports.Drain = exports.AlertEvent = exports.AlertRuleStateModel = exports.AlertRule = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = exports.ProjectTagAssignment = exports.Tag = exports.Invoice = void 0;
|
|
17
|
+
exports.QualifyingActionType = exports.XRobotsTag = exports.XContentTypeOptions = exports.XFrameOptions = exports.StorageMigrationStatus = exports.StorageCredentialStatus = exports.StorageCredentialRole = exports.StorageTokenStatus = exports.StorageUploadStatus = exports.StorageBucketStatus = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_EGRESS_MODE = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.PROJECT_DISABLED_BY = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.SCALING_SOURCE = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_CHANGE_SOURCE = exports.DNS_CHANGE_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.DrainEventType = exports.LogSource = exports.DrainStatus = exports.DrainType = exports.AlertEventStatus = exports.AlertChannelMode = void 0;
|
|
18
|
+
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.CouponRedemptionStatus = exports.CouponScope = exports.CouponDiscountType = exports.WorkbenchMode = exports.QUEST_TARGETLESS_REQUIREMENTS = exports.QUEST_CLAIM_REQUIREMENTS = exports.QuestRequirementType = exports.QuestEntity = exports.QuestCriterionType = exports.QuestRewardStatus = exports.RewardType = exports.EligibilityType = exports.ACTION_TO_MILESTONE = exports.QUEST_COUNTABLE_MILESTONES = exports.MilestoneType = void 0;
|
|
19
19
|
var user_1 = require("./user");
|
|
20
20
|
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
|
|
21
21
|
var project_1 = require("./project");
|
|
@@ -182,6 +182,10 @@ var quest_participation_1 = require("./quest-participation");
|
|
|
182
182
|
Object.defineProperty(exports, "QuestParticipation", { enumerable: true, get: function () { return __importDefault(quest_participation_1).default; } });
|
|
183
183
|
var quest_reward_issuance_1 = require("./quest-reward-issuance");
|
|
184
184
|
Object.defineProperty(exports, "QuestRewardIssuance", { enumerable: true, get: function () { return __importDefault(quest_reward_issuance_1).default; } });
|
|
185
|
+
var coupon_1 = require("./coupon");
|
|
186
|
+
Object.defineProperty(exports, "Coupon", { enumerable: true, get: function () { return __importDefault(coupon_1).default; } });
|
|
187
|
+
var coupon_redemption_1 = require("./coupon-redemption");
|
|
188
|
+
Object.defineProperty(exports, "CouponRedemption", { enumerable: true, get: function () { return __importDefault(coupon_redemption_1).default; } });
|
|
185
189
|
var enum_1 = require("./enum");
|
|
186
190
|
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
187
191
|
Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
|
|
@@ -257,6 +261,9 @@ Object.defineProperty(exports, "QuestRequirementType", { enumerable: true, get:
|
|
|
257
261
|
Object.defineProperty(exports, "QUEST_CLAIM_REQUIREMENTS", { enumerable: true, get: function () { return enum_1.QUEST_CLAIM_REQUIREMENTS; } });
|
|
258
262
|
Object.defineProperty(exports, "QUEST_TARGETLESS_REQUIREMENTS", { enumerable: true, get: function () { return enum_1.QUEST_TARGETLESS_REQUIREMENTS; } });
|
|
259
263
|
Object.defineProperty(exports, "WorkbenchMode", { enumerable: true, get: function () { return enum_1.WorkbenchMode; } });
|
|
264
|
+
Object.defineProperty(exports, "CouponDiscountType", { enumerable: true, get: function () { return enum_1.CouponDiscountType; } });
|
|
265
|
+
Object.defineProperty(exports, "CouponScope", { enumerable: true, get: function () { return enum_1.CouponScope; } });
|
|
266
|
+
Object.defineProperty(exports, "CouponRedemptionStatus", { enumerable: true, get: function () { return enum_1.CouponRedemptionStatus; } });
|
|
260
267
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
261
268
|
const utils_1 = require("@brimble/utils");
|
|
262
269
|
const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -6,7 +6,6 @@ const ProjectDrainSubscriptionSchema = new mongoose_1.Schema({
|
|
|
6
6
|
project: { type: mongoose_1.Schema.Types.ObjectId, ref: "Project", required: true, index: true },
|
|
7
7
|
enabled: { type: Boolean, default: true },
|
|
8
8
|
disabledAt: { type: Date, default: null },
|
|
9
|
-
deletedAt: { type: Date, default: null },
|
|
10
9
|
}, { timestamps: true });
|
|
11
|
-
ProjectDrainSubscriptionSchema.index({ drain: 1, project: 1,
|
|
10
|
+
ProjectDrainSubscriptionSchema.index({ drain: 1, project: 1 }, { unique: true });
|
|
12
11
|
exports.default = (0, mongoose_1.model)("ProjectDrainSubscription", ProjectDrainSubscriptionSchema);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
import { CouponRedemptionStatus, CouponScope } from "../enum";
|
|
3
|
+
export interface ICouponRedemption extends Document {
|
|
4
|
+
coupon_id: Types.ObjectId;
|
|
5
|
+
code: string;
|
|
6
|
+
user_id: Types.ObjectId;
|
|
7
|
+
team_id?: Types.ObjectId | null;
|
|
8
|
+
scope: CouponScope;
|
|
9
|
+
domain_name?: string | null;
|
|
10
|
+
duration_years?: number | null;
|
|
11
|
+
idempotency_key?: string | null;
|
|
12
|
+
transaction_reference?: string | null;
|
|
13
|
+
original_amount: number;
|
|
14
|
+
discount_amount: number;
|
|
15
|
+
final_amount: number;
|
|
16
|
+
status: CouponRedemptionStatus;
|
|
17
|
+
reserved_at: Date;
|
|
18
|
+
applied_at?: Date | null;
|
|
19
|
+
reversed_at?: Date | null;
|
|
20
|
+
created_at?: Date;
|
|
21
|
+
updated_at?: Date;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { CouponDiscountType, CouponScope } from "../enum";
|
|
3
|
+
export interface ICoupon extends Document {
|
|
4
|
+
code: string;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
scope: CouponScope;
|
|
7
|
+
discount_type: CouponDiscountType;
|
|
8
|
+
discount_value: number;
|
|
9
|
+
currency: string;
|
|
10
|
+
max_redemptions?: number | null;
|
|
11
|
+
max_redemptions_per_user: number;
|
|
12
|
+
redemption_count: number;
|
|
13
|
+
min_purchase_amount?: number | null;
|
|
14
|
+
allowed_tlds: string[];
|
|
15
|
+
max_duration_years?: number | null;
|
|
16
|
+
allow_below_cost: boolean;
|
|
17
|
+
starts_at?: Date | null;
|
|
18
|
+
expires_at?: Date | null;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
created_by?: string | null;
|
|
21
|
+
disabled_at?: Date | null;
|
|
22
|
+
created_at?: Date;
|
|
23
|
+
updated_at?: Date;
|
|
24
|
+
}
|
package/dist/types/drain.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface IDrain extends Document {
|
|
|
13
13
|
region?: string;
|
|
14
14
|
endpoint?: string | null;
|
|
15
15
|
keyPrefix?: string;
|
|
16
|
+
storageBucketId?: Types.ObjectId | null;
|
|
17
|
+
storageCredentialId?: Types.ObjectId | null;
|
|
16
18
|
} | null;
|
|
17
19
|
secretsRef: string;
|
|
18
20
|
sources: LogSource[];
|
|
@@ -20,7 +22,6 @@ export interface IDrain extends Document {
|
|
|
20
22
|
statusReason?: string | null;
|
|
21
23
|
failingSince?: Date | null;
|
|
22
24
|
disabledAt?: Date | null;
|
|
23
|
-
deletedAt?: Date | null;
|
|
24
25
|
createdAt: Date;
|
|
25
26
|
updatedAt: Date;
|
|
26
27
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -79,3 +79,5 @@ export type { IQuestCampaign, IQuestCriterion, IQuestRequirement, IQuestReward,
|
|
|
79
79
|
export type { IQuestParticipation, IQuestCriterionProgress, } from "./quest-participation";
|
|
80
80
|
export type { IQuestRewardIssuance, IQuestIssuedReward, } from "./quest-reward-issuance";
|
|
81
81
|
export type { IStorageBucket, IStorageObject, IStorageUpload, IStorageToken, IStorageCredential, IStorageMigration, StorageTokenPermission, StorageLifecycleRule, StorageCorsRule, StorageLifecycleRuleTransition } from "./storage";
|
|
82
|
+
export type { ICoupon } from "./coupon";
|
|
83
|
+
export type { ICouponRedemption } from "./coupon-redemption";
|