This is my College model
module.exports = {
attributes: {
name:{
type:'string',
required:true
},
location:{
type:'string',
required:true
},
faculties:{
collection:'faculty',
via:'college'
}
}
};
This is my Faculty model
module.exports = {
attributes: {
name:{
type:'string',
required:true
},
description:{
type:'string'
},
college:{
model:'college',
required:true
}
,
years:{
collection:'year',
via:'faculty'
}
}
};
My problem is that I can add new Faculty
with any value in college
attribute. If I don't have college with 3000 id, I can still add it but college
attribute won't show up when I list all faculties. How can I prevent it from adding a faculty with invalid college id?