mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
102 lines
1.5 KiB
JavaScript
102 lines
1.5 KiB
JavaScript
import moment from 'moment';
|
|
|
|
const schema = {
|
|
|
|
// default properties
|
|
|
|
_id: {
|
|
type: String,
|
|
optional: true,
|
|
viewableBy: ['guests'],
|
|
},
|
|
createdAt: {
|
|
type: Date,
|
|
optional: true,
|
|
viewableBy: ['guests'],
|
|
onInsert: (document, currentUser) => {
|
|
return new Date();
|
|
},
|
|
},
|
|
userId: {
|
|
type: String,
|
|
optional: true,
|
|
viewableBy: ['guests'],
|
|
},
|
|
|
|
// custom properties
|
|
|
|
associatedCollection: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
|
|
associatedId: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
|
|
tokenId: {
|
|
type: String,
|
|
optional: false,
|
|
},
|
|
|
|
productKey: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
|
|
type: {
|
|
type: String,
|
|
optional: false,
|
|
},
|
|
|
|
test: {
|
|
type: Boolean,
|
|
optional: true,
|
|
},
|
|
|
|
data: {
|
|
type: Object,
|
|
viewableBy: ['guests'],
|
|
blackbox: true,
|
|
},
|
|
|
|
properties: {
|
|
type: Object,
|
|
blackbox: true,
|
|
},
|
|
|
|
ip: {
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
|
|
// GraphQL only
|
|
|
|
createdAtFormatted: {
|
|
type: String,
|
|
optional: true,
|
|
viewableBy: ['guests'],
|
|
resolveAs: {
|
|
type: 'String',
|
|
resolver: (charge, args, context) => {
|
|
return moment(charge.createdAt).format('dddd, MMMM Do YYYY');
|
|
}
|
|
}
|
|
},
|
|
|
|
stripeChargeUrl: {
|
|
type: String,
|
|
optional: true,
|
|
viewableBy: ['guests'],
|
|
resolveAs: {
|
|
type: 'String',
|
|
resolver: (charge, args, context) => {
|
|
return `https://dashboard.stripe.com/payments/${charge.data.id}`;
|
|
}
|
|
}
|
|
},
|
|
|
|
};
|
|
|
|
export default schema;
|