import SimpleSchema from 'simpl-schema'; import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS'; import { InferType, TypedSimpleSchema } from '/imports/api/utility/TypedSimpleSchema'; const SharingSchema = TypedSimpleSchema.from({ owner: { type: String, max: 32, index: 1 }, readers: { type: Array, defaultValue: [], index: 1, maxCount: STORAGE_LIMITS.readersCount, }, 'readers.$': { type: String, regEx: SimpleSchema.RegEx.Id }, writers: { type: Array, defaultValue: [], index: 1, maxCount: STORAGE_LIMITS.writersCount, }, 'writers.$': { type: String, regEx: SimpleSchema.RegEx.Id }, public: { type: Boolean, defaultValue: false, index: 1, }, readersCanCopy: { type: Boolean, optional: true, }, }); export type Shared = InferType; export default SharingSchema;