mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-23 15:49:10 +00:00
54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
|
import mongoose, {
|
||
|
RequiredFields,
|
||
|
UniqueFields,
|
||
|
EncryptedFields,
|
||
|
Schema,
|
||
|
} from '../Infrastructure/ORM';
|
||
|
|
||
|
const schema: Schema = new Schema({
|
||
|
project: { type: String, ref: 'Project', index: true }, //Which project does this belong to.
|
||
|
|
||
|
enabled: { type: Boolean, default: false },
|
||
|
|
||
|
iv: Schema.Types.Buffer,
|
||
|
|
||
|
createdAt: {
|
||
|
type: Date,
|
||
|
default: Date.now,
|
||
|
},
|
||
|
|
||
|
deleted: { type: Boolean, default: false },
|
||
|
|
||
|
deletedAt: {
|
||
|
type: Date,
|
||
|
},
|
||
|
|
||
|
provider: {
|
||
|
type: String,
|
||
|
enum: ['twilio'],
|
||
|
required: true,
|
||
|
},
|
||
|
|
||
|
providerCredentials: {
|
||
|
twilio: {
|
||
|
accountSid: String,
|
||
|
authToken: String,
|
||
|
phoneNumber: String,
|
||
|
},
|
||
|
},
|
||
|
|
||
|
deletedByUser: { type: String, ref: 'User', index: true },
|
||
|
});
|
||
|
|
||
|
export const requiredFields: RequiredFields = schema.requiredPaths();
|
||
|
|
||
|
export const uniqueFields: UniqueFields = [];
|
||
|
export const encryptedFields: EncryptedFields = [
|
||
|
'providerCredentials.twilio.accountSid',
|
||
|
'providerCredentials.twilio.authToken',
|
||
|
];
|
||
|
|
||
|
export const slugifyField: string = '';
|
||
|
|
||
|
export default mongoose.model('SmsProvider', schema);
|