feat(socialnetwork): enhance folder and video management with user visibility options
- Added functionality to manage selected users for adult folders and erotic videos, allowing for more granular visibility control. - Introduced new endpoints and methods in the SocialNetworkController and SocialNetworkService to handle selected users. - Updated the frontend components to include input fields for selected users in CreateFolderDialog, EditImageDialog, and EroticPicturesView. - Enhanced the routing to support fetching erotic folders and videos by username, improving user experience in profile views.
This commit is contained in:
@@ -25,6 +25,8 @@ import ImageVisibilityUser from './community/image_visibility_user.js';
|
||||
import FolderImageVisibility from './community/folder_image_visibility.js';
|
||||
import ImageImageVisibility from './community/image_image_visibility.js';
|
||||
import FolderVisibilityUser from './community/folder_visibility_user.js';
|
||||
import EroticVideoImageVisibility from './community/erotic_video_image_visibility.js';
|
||||
import EroticVideoVisibilityUser from './community/erotic_video_visibility_user.js';
|
||||
import GuestbookEntry from './community/guestbook.js';
|
||||
import Forum from './forum/forum.js';
|
||||
import Title from './forum/title.js';
|
||||
@@ -242,6 +244,17 @@ export default function setupAssociations() {
|
||||
otherKey: 'imageId'
|
||||
});
|
||||
|
||||
EroticVideo.belongsToMany(ImageVisibilityType, {
|
||||
through: EroticVideoImageVisibility,
|
||||
foreignKey: 'eroticVideoId',
|
||||
otherKey: 'visibilityTypeId'
|
||||
});
|
||||
ImageVisibilityType.belongsToMany(EroticVideo, {
|
||||
through: EroticVideoImageVisibility,
|
||||
foreignKey: 'visibilityTypeId',
|
||||
otherKey: 'eroticVideoId'
|
||||
});
|
||||
|
||||
Folder.belongsToMany(ImageVisibilityUser, {
|
||||
through: FolderVisibilityUser,
|
||||
foreignKey: 'folderId',
|
||||
@@ -253,6 +266,19 @@ export default function setupAssociations() {
|
||||
otherKey: 'folderId'
|
||||
});
|
||||
|
||||
EroticVideo.belongsToMany(User, {
|
||||
through: EroticVideoVisibilityUser,
|
||||
foreignKey: 'eroticVideoId',
|
||||
otherKey: 'userId',
|
||||
as: 'selectedVisibilityUsers'
|
||||
});
|
||||
User.belongsToMany(EroticVideo, {
|
||||
through: EroticVideoVisibilityUser,
|
||||
foreignKey: 'userId',
|
||||
otherKey: 'eroticVideoId',
|
||||
as: 'visibleEroticVideos'
|
||||
});
|
||||
|
||||
// Guestbook related associations
|
||||
User.hasMany(GuestbookEntry, { foreignKey: 'recipientId', as: 'receivedEntries' });
|
||||
User.hasMany(GuestbookEntry, { foreignKey: 'senderId', as: 'sentEntries' });
|
||||
|
||||
26
backend/models/community/erotic_video_image_visibility.js
Normal file
26
backend/models/community/erotic_video_image_visibility.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { sequelize } from '../../utils/sequelize.js';
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
const EroticVideoImageVisibility = sequelize.define('erotic_video_image_visibility', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
allowNull: false
|
||||
},
|
||||
eroticVideoId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false
|
||||
},
|
||||
visibilityTypeId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false
|
||||
}
|
||||
}, {
|
||||
tableName: 'erotic_video_image_visibility',
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
schema: 'community'
|
||||
});
|
||||
|
||||
export default EroticVideoImageVisibility;
|
||||
26
backend/models/community/erotic_video_visibility_user.js
Normal file
26
backend/models/community/erotic_video_visibility_user.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { sequelize } from '../../utils/sequelize.js';
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
const EroticVideoVisibilityUser = sequelize.define('erotic_video_visibility_user', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
allowNull: false
|
||||
},
|
||||
eroticVideoId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false
|
||||
},
|
||||
userId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false
|
||||
}
|
||||
}, {
|
||||
tableName: 'erotic_video_visibility_user',
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
schema: 'community'
|
||||
});
|
||||
|
||||
export default EroticVideoVisibilityUser;
|
||||
@@ -25,6 +25,8 @@ import ImageVisibilityUser from './community/image_visibility_user.js';
|
||||
import FolderImageVisibility from './community/folder_image_visibility.js';
|
||||
import ImageImageVisibility from './community/image_image_visibility.js';
|
||||
import FolderVisibilityUser from './community/folder_visibility_user.js';
|
||||
import EroticVideoImageVisibility from './community/erotic_video_image_visibility.js';
|
||||
import EroticVideoVisibilityUser from './community/erotic_video_visibility_user.js';
|
||||
import GuestbookEntry from './community/guestbook.js';
|
||||
import DiaryHistory from './community/diary_history.js';
|
||||
import Diary from './community/diary.js';
|
||||
@@ -179,6 +181,8 @@ const models = {
|
||||
FolderImageVisibility,
|
||||
ImageImageVisibility,
|
||||
FolderVisibilityUser,
|
||||
EroticVideoImageVisibility,
|
||||
EroticVideoVisibilityUser,
|
||||
GuestbookEntry,
|
||||
DiaryHistory,
|
||||
Diary,
|
||||
|
||||
Reference in New Issue
Block a user