Add region relationship to ChurchOffice model: Establish associations between ChurchOffice and RegionData, allowing for better organization of church offices by region. Enhance logging in getChurchOverview method for improved debugging and error handling.
This commit is contained in:
@@ -913,6 +913,16 @@ export default function setupAssociations() {
|
||||
as: 'supervisor'
|
||||
});
|
||||
|
||||
// Region relationship
|
||||
ChurchOffice.belongsTo(RegionData, {
|
||||
foreignKey: 'regionId',
|
||||
as: 'region'
|
||||
});
|
||||
RegionData.hasMany(ChurchOffice, {
|
||||
foreignKey: 'regionId',
|
||||
as: 'churchOffices'
|
||||
});
|
||||
|
||||
// Applications for church office
|
||||
ChurchApplication.belongsTo(ChurchOfficeType, {
|
||||
foreignKey: 'officeTypeId',
|
||||
|
||||
Reference in New Issue
Block a user