Ich habe zwei Modelle in SegelReferenzen (Fremdschlüssel) in sailsjs
1. User_type
2. User
user_type Modell:
module.exports = { schema: true, connection: 'mongo', attributes: { user_type: { type: 'string', required: true, enum: ['superadmin', 'admin', 'follower'] }, toJSON() { return this.toObject(); } }, beforeUpdate: (values, next) => next(), beforeCreate: (values, next) => next() };
Benutzermodell:
module.exports = { schema: true, attributes: { fname: { type: 'string', required: true, }, user_login_type: { // This user_login_type should be having values from // User_type Model with a reference to field 'user_type', that is // whatever values(superadmin', 'admin', 'follower') are in the // 'user_type' of collection(or model) 'User_type' should only be // allowed to enter here, and no else value }, toJSON() { return this.toObject(); } }, beforeUpdate: (values, next) => next(), beforeCreate: (values, next) => next() };
ich auf verschiedene Dokumente verweisen, Fragen und Antworten, aber ich bin nicht die genauen Strömungs bekommen, wie diese
Jede Hilfe bei den Segeln zu tun, ist wirklich nennenswerte