feat(DiaryDateActivity, DiaryView): integrate groupId for enhanced activity management
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 42s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 42s
- Added `groupId` field to the DiaryDateActivity model to support group-specific activities. - Updated create and update methods in DiaryDateActivityService to handle groupId, ensuring proper validation and association with groups. - Enhanced DiaryView component to allow selection of groups for activities, improving user experience and activity organization. - Implemented filtering logic in DiaryView to display activities based on selected group, enhancing data clarity and usability.
This commit is contained in:
@@ -2,6 +2,7 @@ import { DataTypes } from 'sequelize';
|
||||
import sequelize from '../database.js';
|
||||
import DiaryDate from './DiaryDates.js';
|
||||
import PredefinedActivity from './PredefinedActivity.js';
|
||||
import Group from './Group.js';
|
||||
|
||||
const DiaryDateActivity = sequelize.define('DiaryDateActivity', {
|
||||
id: {
|
||||
@@ -31,6 +32,15 @@ const DiaryDateActivity = sequelize.define('DiaryDateActivity', {
|
||||
key: 'id',
|
||||
},
|
||||
onDelete: 'SET NULL',
|
||||
},
|
||||
groupId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
references: {
|
||||
model: Group,
|
||||
key: 'id'
|
||||
},
|
||||
onDelete: 'SET NULL'
|
||||
},
|
||||
duration: {
|
||||
type: DataTypes.INTEGER,
|
||||
|
||||
@@ -219,6 +219,9 @@ GroupActivity.belongsTo(Group, { foreignKey: 'groupId', as: 'groupsGroupActivity
|
||||
GroupActivity.belongsTo(PredefinedActivity, { foreignKey: 'customActivity', as: 'groupPredefinedActivity' });
|
||||
PredefinedActivity.hasMany(GroupActivity, { foreignKey: 'predefinedActivityId', as: 'groupPredefinedActivities' });
|
||||
|
||||
DiaryDateActivity.belongsTo(Group, { foreignKey: 'groupId', as: 'planGroup' });
|
||||
Group.hasMany(DiaryDateActivity, { foreignKey: 'groupId', as: 'groupPlanItems' });
|
||||
|
||||
DiaryTag.hasMany(DiaryDateTag, { foreignKey: 'tagId', as: 'diaryDateTags' });
|
||||
DiaryDateTag.belongsTo(DiaryTag, { foreignKey: 'tagId', as: 'tag' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user