Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
type: Array
},
'issues.$': {
type: String
},
// 已投票使用者userId
votes: {
type: Array,
defaultValue: []
},
'votes.$': {
type: String
},
// 活躍玩家人數
activeUserCount: {
type: SimpleSchema.Integer,
min: 0
}
});
dbRuleAgendas.attachSchema(schema);
dbRuleAgendas.findByIdOrThrow = function(id, options) {
const result = dbRuleAgendas.findOne(id, options);
if (! result) {
throw new Meteor.Error(404, `找不到識別碼為「${id}」的提案!`);
}
return result;
};
const schema = new SimpleSchema({
// 商業季度
seasonId: {
type: String
},
// 使用者ID
userId: {
type: String
},
// 擁有現金
money: {
type: SimpleSchema.Integer
},
// 持股總價值
stocksValue: {
type: SimpleSchema.Integer
}
});
dbRankUserWealth.attachSchema(schema);
},
// 結束日期
endDate: {
type: Date
},
// 當季有多少驗證通過的使用者
userCount: {
type: SimpleSchema.Integer
},
// 當季起始時有多少未被查封的公司
companiesCount: {
type: SimpleSchema.Integer
},
// 當季有多少推出的新產品
productCount: {
type: SimpleSchema.Integer
}
});
dbSeason.attachSchema(schema);
// 取得目前商業季度
export function getCurrentSeason() {
return dbSeason.findOne({}, { sort: { beginDate: -1 } }); // TODO 以實際開始時間取代對齊的開始時間
}
// 取得前一個商業季度
export function getPreviousSeason() {
return dbSeason.findOne({}, { sort: { beginDate: -1 }, skip: 1 });
}
// 每個使用者在季度一開始有多少推薦票
export function getInitialVoteTicketCount(seasonData) {
* @property {string} transactionId optional: true, max: 40
* @property {string} customerId optional: true, max: 255
*/
/* prettier-ignore */
/**
* SohaPay checkoutSchema
* @type {SimpleSchema}
*/
SohaPay.checkoutSchema = new SimpleSchema({
language : { type: String, max: 16 },
orderId : { type: String, max: 34 },
customerEmail : { type: String, max: 24, regEx: SimpleSchema.RegEx.Email },
customerPhone : { type: String, max: 15 },
returnUrl : { type: String, max: 255 },
amount : { type: SimpleSchema.Integer, max: 9999999999 },
paymentType : { type: String, max: 1 },
siteCode : { type: String, max: 8 },
transactionInfo : { type: String, max: 255 },
version : { type: String, max: 1 },
locale : { type: String, optional: true, max: 2 },
currency : { type: String, optional: true, max: 4 },
billingCity : { type: String, optional: true, max: 64 },
billingCountry : { type: String, optional: true, max: 2 },
billingPostCode : { type: String, optional: true, max: 64 },
billingStateProvince : { type: String, optional: true, max: 64 },
billingStreet : { type: String, optional: true, max: 64 },
deliveryAddress : { type: String, optional: true, max: 255 },
deliveryCity : { type: String, optional: true, max: 255 },
deliveryCountry : { type: String, optional: true, max: 255 },
deliveryProvince : { type: String, optional: true, max: 255 },
clientIp : { type: String, optional: true, max: 15 },
optional: true
},
fullName: String
});
const orderItemsSchema = new SimpleSchema({
"addedAt": {
type: Date,
optional: true
},
"price": Number,
"productConfiguration": Object,
"productConfiguration.productId": String,
"productConfiguration.productVariantId": String,
"quantity": {
type: SimpleSchema.Integer,
min: 1
}
});
const orderFulfillmentGroupSchema = new SimpleSchema({
"data": {
type: Object,
blackbox: true,
optional: true
},
"items": {
type: Array,
minCount: 1
},
"items.$": orderItemsSchema,
"selectedFulfillmentMethodId": String,
import SimpleSchema from "simpl-schema";
import { ProductConfigurationSchema } from "../simpleSchemas.js";
export const inputSchema = new SimpleSchema({
productConfiguration: ProductConfigurationSchema,
canBackorder: {
type: Boolean,
optional: true
},
inventoryInStock: {
type: SimpleSchema.Integer,
min: 0,
optional: true
},
isEnabled: {
type: Boolean,
optional: true
},
lowInventoryWarningThreshold: {
type: SimpleSchema.Integer,
min: 0,
optional: true
},
shopId: String
});
export const updateFields = [
"completeConfig.treatments": {
type: Array,
minCount: 1,
maxCount() {
return Treatments.find().count();
}
},
"completeConfig.treatments.$": {
type: Object
},
"completeConfig.treatments.$._id": {
type: String,
regEx: SimpleSchema.RegEx.Id
},
"completeConfig.treatments.$.count": {
type: SimpleSchema.Integer,
minCount: 1,
maxCount: maxGamesCount
},
"completeConfig.treatments.$.lobbyConfigId": {
type: String,
regEx: SimpleSchema.RegEx.Id
}
});
if (Meteor.isDevelopment || Meteor.settings.public.debug_gameDebugMode) {
Batches.schema.extend(DebugModeSchema);
}
Batches.schema.extend(Batches.statusSchema);
Batches.schema.extend(TimestampSchema);
Meteor.startup(function() {
type: String,
optional: true
},
"audience": {
type: Array,
optional: true
},
"audience.$": {
type: String
},
"structure": {
type: LayoutStructure,
optional: true
},
"priority": {
type: SimpleSchema.Integer,
optional: true,
defaultValue: 999
},
"position": {
type: SimpleSchema.Integer,
optional: true,
defaultValue: 1
}
});
registerSchema("Layout", Layout);
foreignKey: "Collections",
optional: true,
},
lastReadPostId: {
type: String,
foreignKey: "Posts",
},
nextPostId: {
type: String,
foreignKey: "Posts",
},
numRead: {
type: SimpleSchema.Integer,
},
numTotal: {
type: SimpleSchema.Integer,
},
lastReadTime: {
type: Date,
optional: true,
},
});
addFieldsDict(Users, {
createdAt: {
type: Date,
onInsert: (user, options) => {
return user.createdAt || new Date();
},
canRead: ["guests"]
},
productConfiguration: ProductConfigurationSchema,
canBackorder: {
type: Boolean,
optional: true
},
inventoryInStock: {
type: SimpleSchema.Integer,
min: 0,
optional: true
},
isEnabled: {
type: Boolean,
optional: true
},
lowInventoryWarningThreshold: {
type: SimpleSchema.Integer,
min: 0,
optional: true
},
shopId: String
});
export const updateFields = [
"canBackorder",
"inventoryInStock",
"isEnabled",
"lowInventoryWarningThreshold"
];
export const defaultValues = {
canBackorder: false,
inventoryInStock: 0,