Compare commits

..

1 Commits

Author SHA1 Message Date
Flatlogic Bot
2a26043576 Updated via schema editor on 2025-06-16 14:32 2025-06-16 14:33:27 +00:00
17 changed files with 1402 additions and 912 deletions

5
.gitignore vendored
View File

@ -1,3 +1,8 @@
node_modules/ node_modules/
*/node_modules/ */node_modules/
*/build/ */build/
**/node_modules/
**/build/
.DS_Store
.env

File diff suppressed because one or more lines are too long

View File

@ -190,10 +190,6 @@ module.exports = class SongsDBApi {
const output = songs.get({ plain: true }); const output = songs.get({ plain: true });
output.comments_song = await songs.getComments_song({
transaction,
});
output.duets_original_song = await songs.getDuets_original_song({ output.duets_original_song = await songs.getDuets_original_song({
transaction, transaction,
}); });
@ -202,6 +198,10 @@ module.exports = class SongsDBApi {
transaction, transaction,
}); });
output.comments_song = await songs.getComments_song({
transaction,
});
output.reports_reported_content = await songs.getReports_reported_content({ output.reports_reported_content = await songs.getReports_reported_content({
transaction, transaction,
}); });

View File

@ -267,7 +267,7 @@ module.exports = class UsersDBApi {
const output = users.get({ plain: true }); const output = users.get({ plain: true });
output.comments_user = await users.getComments_user({ output.songs_artist = await users.getSongs_artist({
transaction, transaction,
}); });
@ -275,7 +275,7 @@ module.exports = class UsersDBApi {
transaction, transaction,
}); });
output.likes_user = await users.getLikes_user({ output.playlists_creator = await users.getPlaylists_creator({
transaction, transaction,
}); });
@ -283,15 +283,11 @@ module.exports = class UsersDBApi {
transaction, transaction,
}); });
output.playlists_creator = await users.getPlaylists_creator({ output.likes_user = await users.getLikes_user({
transaction, transaction,
}); });
output.reports_reporter = await users.getReports_reporter({ output.comments_user = await users.getComments_user({
transaction,
});
output.songs_artist = await users.getSongs_artist({
transaction, transaction,
}); });
@ -303,6 +299,10 @@ module.exports = class UsersDBApi {
transaction, transaction,
}); });
output.reports_reporter = await users.getReports_reporter({
transaction,
});
output.avatar = await users.getAvatar({ output.avatar = await users.getAvatar({
transaction, transaction,
}); });

View File

@ -0,0 +1,36 @@
module.exports = {
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async up(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
/**
* @param {QueryInterface} queryInterface
* @param {Sequelize} Sequelize
* @returns {Promise<void>}
*/
async down(queryInterface, Sequelize) {
/**
* @type {Transaction}
*/
const transaction = await queryInterface.sequelize.transaction();
try {
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
};

View File

@ -66,14 +66,6 @@ module.exports = function (sequelize, DataTypes) {
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity /// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
db.songs.hasMany(db.comments, {
as: 'comments_song',
foreignKey: {
name: 'songId',
},
constraints: false,
});
db.songs.hasMany(db.duets, { db.songs.hasMany(db.duets, {
as: 'duets_original_song', as: 'duets_original_song',
foreignKey: { foreignKey: {
@ -90,6 +82,14 @@ module.exports = function (sequelize, DataTypes) {
constraints: false, constraints: false,
}); });
db.songs.hasMany(db.comments, {
as: 'comments_song',
foreignKey: {
name: 'songId',
},
constraints: false,
});
db.songs.hasMany(db.reports, { db.songs.hasMany(db.reports, {
as: 'reports_reported_content', as: 'reports_reported_content',
foreignKey: { foreignKey: {

View File

@ -102,10 +102,10 @@ module.exports = function (sequelize, DataTypes) {
/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity /// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity
db.users.hasMany(db.comments, { db.users.hasMany(db.songs, {
as: 'comments_user', as: 'songs_artist',
foreignKey: { foreignKey: {
name: 'userId', name: 'artistId',
}, },
constraints: false, constraints: false,
}); });
@ -118,10 +118,10 @@ module.exports = function (sequelize, DataTypes) {
constraints: false, constraints: false,
}); });
db.users.hasMany(db.likes, { db.users.hasMany(db.playlists, {
as: 'likes_user', as: 'playlists_creator',
foreignKey: { foreignKey: {
name: 'userId', name: 'creatorId',
}, },
constraints: false, constraints: false,
}); });
@ -134,26 +134,18 @@ module.exports = function (sequelize, DataTypes) {
constraints: false, constraints: false,
}); });
db.users.hasMany(db.playlists, { db.users.hasMany(db.likes, {
as: 'playlists_creator', as: 'likes_user',
foreignKey: { foreignKey: {
name: 'creatorId', name: 'userId',
}, },
constraints: false, constraints: false,
}); });
db.users.hasMany(db.reports, { db.users.hasMany(db.comments, {
as: 'reports_reporter', as: 'comments_user',
foreignKey: { foreignKey: {
name: 'reporterId', name: 'userId',
},
constraints: false,
});
db.users.hasMany(db.songs, {
as: 'songs_artist',
foreignKey: {
name: 'artistId',
}, },
constraints: false, constraints: false,
}); });
@ -174,6 +166,14 @@ module.exports = function (sequelize, DataTypes) {
constraints: false, constraints: false,
}); });
db.users.hasMany(db.reports, {
as: 'reports_reporter',
foreignKey: {
name: 'reporterId',
},
constraints: false,
});
//end loop //end loop
db.users.belongsTo(db.roles, { db.users.belongsTo(db.roles, {

View File

@ -100,15 +100,15 @@ module.exports = {
const entities = [ const entities = [
'users', 'users',
'comments',
'duets',
'likes',
'notifications',
'playlists',
'reports',
'songs', 'songs',
'duets',
'playlists',
'notifications',
'likes',
'comments',
'tips', 'tips',
'roles', 'roles',
'reports',
'permissions', 'permissions',
, ,
]; ];
@ -232,112 +232,105 @@ primary key ("roles_permissionsId", "permissionId")
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_COMMENTS'), permissionId: getId('CREATE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_COMMENTS'), permissionId: getId('READ_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_COMMENTS'), permissionId: getId('UPDATE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_COMMENTS'), permissionId: getId('DELETE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_COMMENTS'), permissionId: getId('CREATE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_COMMENTS'), permissionId: getId('READ_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_COMMENTS'), permissionId: getId('UPDATE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_COMMENTS'), permissionId: getId('DELETE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('CREATE_COMMENTS'), permissionId: getId('READ_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_COMMENTS'), permissionId: getId('UPDATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('DELETE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('VerifiedArtist'), roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_COMMENTS'), permissionId: getId('CREATE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('VerifiedArtist'), roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_COMMENTS'), permissionId: getId('READ_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Listener'), roles_permissionsId: getId('Listener'),
permissionId: getId('READ_COMMENTS'), permissionId: getId('READ_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Listener'), roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_COMMENTS'), permissionId: getId('UPDATE_SONGS'),
}, },
{ {
@ -449,98 +442,105 @@ primary key ("roles_permissionsId", "permissionId")
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_LIKES'), permissionId: getId('CREATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_LIKES'), permissionId: getId('READ_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_LIKES'), permissionId: getId('UPDATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_LIKES'), permissionId: getId('DELETE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_LIKES'), permissionId: getId('CREATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_LIKES'), permissionId: getId('READ_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_LIKES'), permissionId: getId('UPDATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_LIKES'), permissionId: getId('DELETE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_LIKES'), permissionId: getId('READ_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_LIKES'), permissionId: getId('UPDATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('VerifiedArtist'), roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_LIKES'), permissionId: getId('CREATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('VerifiedArtist'), roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_LIKES'), permissionId: getId('READ_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Listener'), roles_permissionsId: getId('Listener'),
permissionId: getId('READ_LIKES'), permissionId: getId('READ_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Listener'), roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_LIKES'), permissionId: getId('UPDATE_PLAYLISTS'),
}, },
{ {
@ -631,322 +631,210 @@ primary key ("roles_permissionsId", "permissionId")
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_PLAYLISTS'), permissionId: getId('CREATE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_PLAYLISTS'), permissionId: getId('READ_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_PLAYLISTS'), permissionId: getId('UPDATE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_PLAYLISTS'), permissionId: getId('DELETE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_PLAYLISTS'), permissionId: getId('CREATE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_PLAYLISTS'), permissionId: getId('READ_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_PLAYLISTS'), permissionId: getId('UPDATE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_PLAYLISTS'), permissionId: getId('DELETE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_PLAYLISTS'), permissionId: getId('READ_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_PLAYLISTS'), permissionId: getId('UPDATE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('VerifiedArtist'), roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('CREATE_PLAYLISTS'), permissionId: getId('READ_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('VerifiedArtist'), roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_PLAYLISTS'), permissionId: getId('UPDATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Listener'), roles_permissionsId: getId('Listener'),
permissionId: getId('READ_PLAYLISTS'), permissionId: getId('READ_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Listener'), roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_PLAYLISTS'), permissionId: getId('UPDATE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_REPORTS'), permissionId: getId('CREATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_REPORTS'), permissionId: getId('READ_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_REPORTS'), permissionId: getId('UPDATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('MusicManager'), roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_REPORTS'), permissionId: getId('DELETE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_REPORTS'), permissionId: getId('CREATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_REPORTS'), permissionId: getId('READ_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_REPORTS'), permissionId: getId('UPDATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('ContentCurator'), roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_REPORTS'), permissionId: getId('DELETE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('CREATE_REPORTS'), permissionId: getId('CREATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_REPORTS'), permissionId: getId('READ_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_REPORTS'), permissionId: getId('UPDATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('CommunityModerator'), roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('DELETE_REPORTS'), permissionId: getId('DELETE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('VerifiedArtist'), roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_REPORTS'), permissionId: getId('READ_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('VerifiedArtist'), roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_REPORTS'), permissionId: getId('UPDATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Listener'), roles_permissionsId: getId('Listener'),
permissionId: getId('READ_REPORTS'), permissionId: getId('READ_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Listener'), roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_REPORTS'), permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('CREATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('READ_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_SONGS'),
}, },
{ {
@ -1033,6 +921,118 @@ primary key ("roles_permissionsId", "permissionId")
permissionId: getId('UPDATE_TIPS'), permissionId: getId('UPDATE_TIPS'),
}, },
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('CREATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('DELETE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_REPORTS'),
},
{ {
createdAt, createdAt,
updatedAt, updatedAt,
@ -1097,25 +1097,25 @@ primary key ("roles_permissionsId", "permissionId")
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_COMMENTS'), permissionId: getId('CREATE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_COMMENTS'), permissionId: getId('READ_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_COMMENTS'), permissionId: getId('UPDATE_SONGS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_COMMENTS'), permissionId: getId('DELETE_SONGS'),
}, },
{ {
@ -1147,25 +1147,25 @@ primary key ("roles_permissionsId", "permissionId")
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_LIKES'), permissionId: getId('CREATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_LIKES'), permissionId: getId('READ_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_LIKES'), permissionId: getId('UPDATE_PLAYLISTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_LIKES'), permissionId: getId('DELETE_PLAYLISTS'),
}, },
{ {
@ -1197,75 +1197,50 @@ primary key ("roles_permissionsId", "permissionId")
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_PLAYLISTS'), permissionId: getId('CREATE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_PLAYLISTS'), permissionId: getId('READ_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_PLAYLISTS'), permissionId: getId('UPDATE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_PLAYLISTS'), permissionId: getId('DELETE_LIKES'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_REPORTS'), permissionId: getId('CREATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_REPORTS'), permissionId: getId('READ_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_REPORTS'), permissionId: getId('UPDATE_COMMENTS'),
}, },
{ {
createdAt, createdAt,
updatedAt, updatedAt,
roles_permissionsId: getId('Administrator'), roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_REPORTS'), permissionId: getId('DELETE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_SONGS'),
}, },
{ {
@ -1318,6 +1293,31 @@ primary key ("roles_permissionsId", "permissionId")
permissionId: getId('DELETE_ROLES'), permissionId: getId('DELETE_ROLES'),
}, },
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_REPORTS'),
},
{ {
createdAt, createdAt,
updatedAt, updatedAt,

File diff suppressed because it is too large Load Diff

View File

@ -21,24 +21,24 @@ const contactFormRoutes = require('./routes/contactForm');
const usersRoutes = require('./routes/users'); const usersRoutes = require('./routes/users');
const commentsRoutes = require('./routes/comments'); const songsRoutes = require('./routes/songs');
const duetsRoutes = require('./routes/duets'); const duetsRoutes = require('./routes/duets');
const likesRoutes = require('./routes/likes'); const playlistsRoutes = require('./routes/playlists');
const notificationsRoutes = require('./routes/notifications'); const notificationsRoutes = require('./routes/notifications');
const playlistsRoutes = require('./routes/playlists'); const likesRoutes = require('./routes/likes');
const reportsRoutes = require('./routes/reports'); const commentsRoutes = require('./routes/comments');
const songsRoutes = require('./routes/songs');
const tipsRoutes = require('./routes/tips'); const tipsRoutes = require('./routes/tips');
const rolesRoutes = require('./routes/roles'); const rolesRoutes = require('./routes/roles');
const reportsRoutes = require('./routes/reports');
const permissionsRoutes = require('./routes/permissions'); const permissionsRoutes = require('./routes/permissions');
const getBaseUrl = (url) => { const getBaseUrl = (url) => {
@ -113,9 +113,9 @@ app.use(
); );
app.use( app.use(
'/api/comments', '/api/songs',
passport.authenticate('jwt', { session: false }), passport.authenticate('jwt', { session: false }),
commentsRoutes, songsRoutes,
); );
app.use( app.use(
@ -125,9 +125,9 @@ app.use(
); );
app.use( app.use(
'/api/likes', '/api/playlists',
passport.authenticate('jwt', { session: false }), passport.authenticate('jwt', { session: false }),
likesRoutes, playlistsRoutes,
); );
app.use( app.use(
@ -137,21 +137,15 @@ app.use(
); );
app.use( app.use(
'/api/playlists', '/api/likes',
passport.authenticate('jwt', { session: false }), passport.authenticate('jwt', { session: false }),
playlistsRoutes, likesRoutes,
); );
app.use( app.use(
'/api/reports', '/api/comments',
passport.authenticate('jwt', { session: false }), passport.authenticate('jwt', { session: false }),
reportsRoutes, commentsRoutes,
);
app.use(
'/api/songs',
passport.authenticate('jwt', { session: false }),
songsRoutes,
); );
app.use( app.use(
@ -166,6 +160,12 @@ app.use(
rolesRoutes, rolesRoutes,
); );
app.use(
'/api/reports',
passport.authenticate('jwt', { session: false }),
reportsRoutes,
);
app.use( app.use(
'/api/permissions', '/api/permissions',
passport.authenticate('jwt', { session: false }), passport.authenticate('jwt', { session: false }),

View File

@ -43,15 +43,15 @@ module.exports = class SearchService {
const tableColumns = { const tableColumns = {
users: ['firstName', 'lastName', 'phoneNumber', 'email'], users: ['firstName', 'lastName', 'phoneNumber', 'email'],
comments: ['content'], songs: ['title', 'description'],
notifications: ['message'],
playlists: ['name'], playlists: ['name'],
reports: ['reason'], notifications: ['message'],
songs: ['title', 'description'], comments: ['content'],
reports: ['reason'],
}; };
const columnsInt = { const columnsInt = {
tips: ['amount'], tips: ['amount'],

View File

@ -17,9 +17,9 @@ export default function WebSiteHeader({ projectName }: WebSiteHeaderProps) {
const websiteHeder = useAppSelector((state) => state.style.websiteHeder); const websiteHeder = useAppSelector((state) => state.style.websiteHeder);
const borders = useAppSelector((state) => state.style.borders); const borders = useAppSelector((state) => state.style.borders);
const style = HeaderStyle.PAGES_RIGHT; const style = HeaderStyle.PAGES_LEFT;
const design = HeaderDesigns.DEFAULT_DESIGN; const design = HeaderDesigns.DESIGN_DIVERSITY;
return ( return (
<header id='websiteHeader' className='overflow-hidden'> <header id='websiteHeader' className='overflow-hidden'>
<div <div

View File

@ -17,15 +17,15 @@ const menuAside: MenuAsideItem[] = [
permissions: 'READ_USERS', permissions: 'READ_USERS',
}, },
{ {
href: '/comments/comments-list', href: '/songs/songs-list',
label: 'Comments', label: 'Songs',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
icon: icon:
'mdiCommentText' in icon 'mdiMusicNote' in icon
? icon['mdiCommentText' as keyof typeof icon] ? icon['mdiMusicNote' as keyof typeof icon]
: icon.mdiTable ?? icon.mdiTable, : icon.mdiTable ?? icon.mdiTable,
permissions: 'READ_COMMENTS', permissions: 'READ_SONGS',
}, },
{ {
href: '/duets/duets-list', href: '/duets/duets-list',
@ -39,15 +39,15 @@ const menuAside: MenuAsideItem[] = [
permissions: 'READ_DUETS', permissions: 'READ_DUETS',
}, },
{ {
href: '/likes/likes-list', href: '/playlists/playlists-list',
label: 'Likes', label: 'Playlists',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
icon: icon:
'mdiThumbUp' in icon 'mdiPlaylistMusic' in icon
? icon['mdiThumbUp' as keyof typeof icon] ? icon['mdiPlaylistMusic' as keyof typeof icon]
: icon.mdiTable ?? icon.mdiTable, : icon.mdiTable ?? icon.mdiTable,
permissions: 'READ_LIKES', permissions: 'READ_PLAYLISTS',
}, },
{ {
href: '/notifications/notifications-list', href: '/notifications/notifications-list',
@ -61,37 +61,26 @@ const menuAside: MenuAsideItem[] = [
permissions: 'READ_NOTIFICATIONS', permissions: 'READ_NOTIFICATIONS',
}, },
{ {
href: '/playlists/playlists-list', href: '/likes/likes-list',
label: 'Playlists', label: 'Likes',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
icon: icon:
'mdiPlaylistMusic' in icon 'mdiThumbUp' in icon
? icon['mdiPlaylistMusic' as keyof typeof icon] ? icon['mdiThumbUp' as keyof typeof icon]
: icon.mdiTable ?? icon.mdiTable, : icon.mdiTable ?? icon.mdiTable,
permissions: 'READ_PLAYLISTS', permissions: 'READ_LIKES',
}, },
{ {
href: '/reports/reports-list', href: '/comments/comments-list',
label: 'Reports', label: 'Comments',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
icon: icon:
'mdiAlertCircle' in icon 'mdiCommentText' in icon
? icon['mdiAlertCircle' as keyof typeof icon] ? icon['mdiCommentText' as keyof typeof icon]
: icon.mdiTable ?? icon.mdiTable, : icon.mdiTable ?? icon.mdiTable,
permissions: 'READ_REPORTS', permissions: 'READ_COMMENTS',
},
{
href: '/songs/songs-list',
label: 'Songs',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
icon:
'mdiMusicNote' in icon
? icon['mdiMusicNote' as keyof typeof icon]
: icon.mdiTable ?? icon.mdiTable,
permissions: 'READ_SONGS',
}, },
{ {
href: '/tips/tips-list', href: '/tips/tips-list',
@ -112,6 +101,17 @@ const menuAside: MenuAsideItem[] = [
icon: icon.mdiShieldAccountVariantOutline ?? icon.mdiTable, icon: icon.mdiShieldAccountVariantOutline ?? icon.mdiTable,
permissions: 'READ_ROLES', permissions: 'READ_ROLES',
}, },
{
href: '/reports/reports-list',
label: 'Reports',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
icon:
'mdiAlertCircle' in icon
? icon['mdiAlertCircle' as keyof typeof icon]
: icon.mdiTable ?? icon.mdiTable,
permissions: 'READ_REPORTS',
},
{ {
href: '/permissions/permissions-list', href: '/permissions/permissions-list',
label: 'Permissions', label: 'Permissions',

View File

@ -29,15 +29,15 @@ const Dashboard = () => {
}); });
const [users, setUsers] = React.useState(loadingMessage); const [users, setUsers] = React.useState(loadingMessage);
const [comments, setComments] = React.useState(loadingMessage);
const [duets, setDuets] = React.useState(loadingMessage);
const [likes, setLikes] = React.useState(loadingMessage);
const [notifications, setNotifications] = React.useState(loadingMessage);
const [playlists, setPlaylists] = React.useState(loadingMessage);
const [reports, setReports] = React.useState(loadingMessage);
const [songs, setSongs] = React.useState(loadingMessage); const [songs, setSongs] = React.useState(loadingMessage);
const [duets, setDuets] = React.useState(loadingMessage);
const [playlists, setPlaylists] = React.useState(loadingMessage);
const [notifications, setNotifications] = React.useState(loadingMessage);
const [likes, setLikes] = React.useState(loadingMessage);
const [comments, setComments] = React.useState(loadingMessage);
const [tips, setTips] = React.useState(loadingMessage); const [tips, setTips] = React.useState(loadingMessage);
const [roles, setRoles] = React.useState(loadingMessage); const [roles, setRoles] = React.useState(loadingMessage);
const [reports, setReports] = React.useState(loadingMessage);
const [permissions, setPermissions] = React.useState(loadingMessage); const [permissions, setPermissions] = React.useState(loadingMessage);
const [widgetsRole, setWidgetsRole] = React.useState({ const [widgetsRole, setWidgetsRole] = React.useState({
@ -51,28 +51,28 @@ const Dashboard = () => {
async function loadData() { async function loadData() {
const entities = [ const entities = [
'users', 'users',
'comments',
'duets',
'likes',
'notifications',
'playlists',
'reports',
'songs', 'songs',
'duets',
'playlists',
'notifications',
'likes',
'comments',
'tips', 'tips',
'roles', 'roles',
'reports',
'permissions', 'permissions',
]; ];
const fns = [ const fns = [
setUsers, setUsers,
setComments,
setDuets,
setLikes,
setNotifications,
setPlaylists,
setReports,
setSongs, setSongs,
setDuets,
setPlaylists,
setNotifications,
setLikes,
setComments,
setTips, setTips,
setRoles, setRoles,
setReports,
setPermissions, setPermissions,
]; ];
@ -220,8 +220,8 @@ const Dashboard = () => {
</Link> </Link>
)} )}
{hasPermission(currentUser, 'READ_COMMENTS') && ( {hasPermission(currentUser, 'READ_SONGS') && (
<Link href={'/comments/comments-list'}> <Link href={'/songs/songs-list'}>
<div <div
className={`${ className={`${
corners !== 'rounded-full' ? corners : 'rounded-3xl' corners !== 'rounded-full' ? corners : 'rounded-3xl'
@ -230,10 +230,10 @@ const Dashboard = () => {
<div className='flex justify-between align-center'> <div className='flex justify-between align-center'>
<div> <div>
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'> <div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
Comments Songs
</div> </div>
<div className='text-3xl leading-tight font-semibold'> <div className='text-3xl leading-tight font-semibold'>
{comments} {songs}
</div> </div>
</div> </div>
<div> <div>
@ -245,8 +245,8 @@ const Dashboard = () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
path={ path={
'mdiCommentText' in icon 'mdiMusicNote' in icon
? icon['mdiCommentText' as keyof typeof icon] ? icon['mdiMusicNote' as keyof typeof icon]
: icon.mdiTable || icon.mdiTable : icon.mdiTable || icon.mdiTable
} }
/> />
@ -292,8 +292,8 @@ const Dashboard = () => {
</Link> </Link>
)} )}
{hasPermission(currentUser, 'READ_LIKES') && ( {hasPermission(currentUser, 'READ_PLAYLISTS') && (
<Link href={'/likes/likes-list'}> <Link href={'/playlists/playlists-list'}>
<div <div
className={`${ className={`${
corners !== 'rounded-full' ? corners : 'rounded-3xl' corners !== 'rounded-full' ? corners : 'rounded-3xl'
@ -302,10 +302,10 @@ const Dashboard = () => {
<div className='flex justify-between align-center'> <div className='flex justify-between align-center'>
<div> <div>
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'> <div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
Likes Playlists
</div> </div>
<div className='text-3xl leading-tight font-semibold'> <div className='text-3xl leading-tight font-semibold'>
{likes} {playlists}
</div> </div>
</div> </div>
<div> <div>
@ -317,8 +317,8 @@ const Dashboard = () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
path={ path={
'mdiThumbUp' in icon 'mdiPlaylistMusic' in icon
? icon['mdiThumbUp' as keyof typeof icon] ? icon['mdiPlaylistMusic' as keyof typeof icon]
: icon.mdiTable || icon.mdiTable : icon.mdiTable || icon.mdiTable
} }
/> />
@ -364,8 +364,8 @@ const Dashboard = () => {
</Link> </Link>
)} )}
{hasPermission(currentUser, 'READ_PLAYLISTS') && ( {hasPermission(currentUser, 'READ_LIKES') && (
<Link href={'/playlists/playlists-list'}> <Link href={'/likes/likes-list'}>
<div <div
className={`${ className={`${
corners !== 'rounded-full' ? corners : 'rounded-3xl' corners !== 'rounded-full' ? corners : 'rounded-3xl'
@ -374,10 +374,10 @@ const Dashboard = () => {
<div className='flex justify-between align-center'> <div className='flex justify-between align-center'>
<div> <div>
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'> <div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
Playlists Likes
</div> </div>
<div className='text-3xl leading-tight font-semibold'> <div className='text-3xl leading-tight font-semibold'>
{playlists} {likes}
</div> </div>
</div> </div>
<div> <div>
@ -389,8 +389,8 @@ const Dashboard = () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
path={ path={
'mdiPlaylistMusic' in icon 'mdiThumbUp' in icon
? icon['mdiPlaylistMusic' as keyof typeof icon] ? icon['mdiThumbUp' as keyof typeof icon]
: icon.mdiTable || icon.mdiTable : icon.mdiTable || icon.mdiTable
} }
/> />
@ -400,8 +400,8 @@ const Dashboard = () => {
</Link> </Link>
)} )}
{hasPermission(currentUser, 'READ_REPORTS') && ( {hasPermission(currentUser, 'READ_COMMENTS') && (
<Link href={'/reports/reports-list'}> <Link href={'/comments/comments-list'}>
<div <div
className={`${ className={`${
corners !== 'rounded-full' ? corners : 'rounded-3xl' corners !== 'rounded-full' ? corners : 'rounded-3xl'
@ -410,10 +410,10 @@ const Dashboard = () => {
<div className='flex justify-between align-center'> <div className='flex justify-between align-center'>
<div> <div>
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'> <div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
Reports Comments
</div> </div>
<div className='text-3xl leading-tight font-semibold'> <div className='text-3xl leading-tight font-semibold'>
{reports} {comments}
</div> </div>
</div> </div>
<div> <div>
@ -425,44 +425,8 @@ const Dashboard = () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
path={ path={
'mdiAlertCircle' in icon 'mdiCommentText' in icon
? icon['mdiAlertCircle' as keyof typeof icon] ? icon['mdiCommentText' as keyof typeof icon]
: icon.mdiTable || icon.mdiTable
}
/>
</div>
</div>
</div>
</Link>
)}
{hasPermission(currentUser, 'READ_SONGS') && (
<Link href={'/songs/songs-list'}>
<div
className={`${
corners !== 'rounded-full' ? corners : 'rounded-3xl'
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className='flex justify-between align-center'>
<div>
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
Songs
</div>
<div className='text-3xl leading-tight font-semibold'>
{songs}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w='w-16'
h='h-16'
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={
'mdiMusicNote' in icon
? icon['mdiMusicNote' as keyof typeof icon]
: icon.mdiTable || icon.mdiTable : icon.mdiTable || icon.mdiTable
} }
/> />
@ -542,6 +506,42 @@ const Dashboard = () => {
</Link> </Link>
)} )}
{hasPermission(currentUser, 'READ_REPORTS') && (
<Link href={'/reports/reports-list'}>
<div
className={`${
corners !== 'rounded-full' ? corners : 'rounded-3xl'
} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className='flex justify-between align-center'>
<div>
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
Reports
</div>
<div className='text-3xl leading-tight font-semibold'>
{reports}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w='w-16'
h='h-16'
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={
'mdiAlertCircle' in icon
? icon['mdiAlertCircle' as keyof typeof icon]
: icon.mdiTable || icon.mdiTable
}
/>
</div>
</div>
</div>
</Link>
)}
{hasPermission(currentUser, 'READ_PERMISSIONS') && ( {hasPermission(currentUser, 'READ_PERMISSIONS') && (
<Link href={'/permissions/permissions-list'}> <Link href={'/permissions/permissions-list'}>
<div <div

View File

@ -166,49 +166,6 @@ const SongsView = () => {
</CardBox> </CardBox>
</> </>
<>
<p className={'block font-bold mb-2'}>Comments Song</p>
<CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable
>
<div className='overflow-x-auto'>
<table>
<thead>
<tr>
<th>Content</th>
<th>CommentDate</th>
</tr>
</thead>
<tbody>
{songs.comments_song &&
Array.isArray(songs.comments_song) &&
songs.comments_song.map((item: any) => (
<tr
key={item.id}
onClick={() =>
router.push(
`/comments/comments-view/?id=${item.id}`,
)
}
>
<td data-label='content'>{item.content}</td>
<td data-label='comment_date'>
{dataFormatter.dateTimeFormatter(item.comment_date)}
</td>
</tr>
))}
</tbody>
</table>
</div>
{!songs?.comments_song?.length && (
<div className={'text-center py-4'}>No data</div>
)}
</CardBox>
</>
<> <>
<p className={'block font-bold mb-2'}>Duets OriginalSong</p> <p className={'block font-bold mb-2'}>Duets OriginalSong</p>
<CardBox <CardBox
@ -283,6 +240,49 @@ const SongsView = () => {
</CardBox> </CardBox>
</> </>
<>
<p className={'block font-bold mb-2'}>Comments Song</p>
<CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable
>
<div className='overflow-x-auto'>
<table>
<thead>
<tr>
<th>Content</th>
<th>CommentDate</th>
</tr>
</thead>
<tbody>
{songs.comments_song &&
Array.isArray(songs.comments_song) &&
songs.comments_song.map((item: any) => (
<tr
key={item.id}
onClick={() =>
router.push(
`/comments/comments-view/?id=${item.id}`,
)
}
>
<td data-label='content'>{item.content}</td>
<td data-label='comment_date'>
{dataFormatter.dateTimeFormatter(item.comment_date)}
</td>
</tr>
))}
</tbody>
</table>
</div>
{!songs?.comments_song?.length && (
<div className={'text-center py-4'}>No data</div>
)}
</CardBox>
</>
<> <>
<p className={'block font-bold mb-2'}>Reports ReportedContent</p> <p className={'block font-bold mb-2'}>Reports ReportedContent</p>
<CardBox <CardBox

View File

@ -139,7 +139,7 @@ const UsersView = () => {
</> </>
<> <>
<p className={'block font-bold mb-2'}>Comments User</p> <p className={'block font-bold mb-2'}>Songs Artist</p>
<CardBox <CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden' className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable hasTable
@ -148,34 +148,40 @@ const UsersView = () => {
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Content</th> <th>Title</th>
<th>CommentDate</th> <th>Description</th>
<th>Genre</th>
<th>ReleaseDate</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{users.comments_user && {users.songs_artist &&
Array.isArray(users.comments_user) && Array.isArray(users.songs_artist) &&
users.comments_user.map((item: any) => ( users.songs_artist.map((item: any) => (
<tr <tr
key={item.id} key={item.id}
onClick={() => onClick={() =>
router.push( router.push(`/songs/songs-view/?id=${item.id}`)
`/comments/comments-view/?id=${item.id}`,
)
} }
> >
<td data-label='content'>{item.content}</td> <td data-label='title'>{item.title}</td>
<td data-label='comment_date'> <td data-label='description'>{item.description}</td>
{dataFormatter.dateTimeFormatter(item.comment_date)}
<td data-label='genre'>{item.genre}</td>
<td data-label='release_date'>
{dataFormatter.dateTimeFormatter(item.release_date)}
</td> </td>
</tr> </tr>
))} ))}
</tbody> </tbody>
</table> </table>
</div> </div>
{!users?.comments_user?.length && ( {!users?.songs_artist?.length && (
<div className={'text-center py-4'}>No data</div> <div className={'text-center py-4'}>No data</div>
)} )}
</CardBox> </CardBox>
@ -219,7 +225,7 @@ const UsersView = () => {
</> </>
<> <>
<p className={'block font-bold mb-2'}>Likes User</p> <p className={'block font-bold mb-2'}>Playlists Creator</p>
<CardBox <CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden' className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable hasTable
@ -228,28 +234,28 @@ const UsersView = () => {
<table> <table>
<thead> <thead>
<tr> <tr>
<th>LikeDate</th> <th>Name</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{users.likes_user && {users.playlists_creator &&
Array.isArray(users.likes_user) && Array.isArray(users.playlists_creator) &&
users.likes_user.map((item: any) => ( users.playlists_creator.map((item: any) => (
<tr <tr
key={item.id} key={item.id}
onClick={() => onClick={() =>
router.push(`/likes/likes-view/?id=${item.id}`) router.push(
`/playlists/playlists-view/?id=${item.id}`,
)
} }
> >
<td data-label='like_date'> <td data-label='name'>{item.name}</td>
{dataFormatter.dateTimeFormatter(item.like_date)}
</td>
</tr> </tr>
))} ))}
</tbody> </tbody>
</table> </table>
</div> </div>
{!users?.likes_user?.length && ( {!users?.playlists_creator?.length && (
<div className={'text-center py-4'}>No data</div> <div className={'text-center py-4'}>No data</div>
)} )}
</CardBox> </CardBox>
@ -307,7 +313,7 @@ const UsersView = () => {
</> </>
<> <>
<p className={'block font-bold mb-2'}>Playlists Creator</p> <p className={'block font-bold mb-2'}>Likes User</p>
<CardBox <CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden' className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable hasTable
@ -316,118 +322,71 @@ const UsersView = () => {
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>LikeDate</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{users.playlists_creator && {users.likes_user &&
Array.isArray(users.playlists_creator) && Array.isArray(users.likes_user) &&
users.playlists_creator.map((item: any) => ( users.likes_user.map((item: any) => (
<tr
key={item.id}
onClick={() =>
router.push(`/likes/likes-view/?id=${item.id}`)
}
>
<td data-label='like_date'>
{dataFormatter.dateTimeFormatter(item.like_date)}
</td>
</tr>
))}
</tbody>
</table>
</div>
{!users?.likes_user?.length && (
<div className={'text-center py-4'}>No data</div>
)}
</CardBox>
</>
<>
<p className={'block font-bold mb-2'}>Comments User</p>
<CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable
>
<div className='overflow-x-auto'>
<table>
<thead>
<tr>
<th>Content</th>
<th>CommentDate</th>
</tr>
</thead>
<tbody>
{users.comments_user &&
Array.isArray(users.comments_user) &&
users.comments_user.map((item: any) => (
<tr <tr
key={item.id} key={item.id}
onClick={() => onClick={() =>
router.push( router.push(
`/playlists/playlists-view/?id=${item.id}`, `/comments/comments-view/?id=${item.id}`,
) )
} }
> >
<td data-label='name'>{item.name}</td> <td data-label='content'>{item.content}</td>
</tr>
))}
</tbody>
</table>
</div>
{!users?.playlists_creator?.length && (
<div className={'text-center py-4'}>No data</div>
)}
</CardBox>
</>
<> <td data-label='comment_date'>
<p className={'block font-bold mb-2'}>Reports Reporter</p> {dataFormatter.dateTimeFormatter(item.comment_date)}
<CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable
>
<div className='overflow-x-auto'>
<table>
<thead>
<tr>
<th>Reason</th>
<th>ReportDate</th>
</tr>
</thead>
<tbody>
{users.reports_reporter &&
Array.isArray(users.reports_reporter) &&
users.reports_reporter.map((item: any) => (
<tr
key={item.id}
onClick={() =>
router.push(`/reports/reports-view/?id=${item.id}`)
}
>
<td data-label='reason'>{item.reason}</td>
<td data-label='report_date'>
{dataFormatter.dateTimeFormatter(item.report_date)}
</td> </td>
</tr> </tr>
))} ))}
</tbody> </tbody>
</table> </table>
</div> </div>
{!users?.reports_reporter?.length && ( {!users?.comments_user?.length && (
<div className={'text-center py-4'}>No data</div>
)}
</CardBox>
</>
<>
<p className={'block font-bold mb-2'}>Songs Artist</p>
<CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable
>
<div className='overflow-x-auto'>
<table>
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th>Genre</th>
<th>ReleaseDate</th>
</tr>
</thead>
<tbody>
{users.songs_artist &&
Array.isArray(users.songs_artist) &&
users.songs_artist.map((item: any) => (
<tr
key={item.id}
onClick={() =>
router.push(`/songs/songs-view/?id=${item.id}`)
}
>
<td data-label='title'>{item.title}</td>
<td data-label='description'>{item.description}</td>
<td data-label='genre'>{item.genre}</td>
<td data-label='release_date'>
{dataFormatter.dateTimeFormatter(item.release_date)}
</td>
</tr>
))}
</tbody>
</table>
</div>
{!users?.songs_artist?.length && (
<div className={'text-center py-4'}>No data</div> <div className={'text-center py-4'}>No data</div>
)} )}
</CardBox> </CardBox>
@ -515,6 +474,47 @@ const UsersView = () => {
</CardBox> </CardBox>
</> </>
<>
<p className={'block font-bold mb-2'}>Reports Reporter</p>
<CardBox
className='mb-6 border border-gray-300 rounded overflow-hidden'
hasTable
>
<div className='overflow-x-auto'>
<table>
<thead>
<tr>
<th>Reason</th>
<th>ReportDate</th>
</tr>
</thead>
<tbody>
{users.reports_reporter &&
Array.isArray(users.reports_reporter) &&
users.reports_reporter.map((item: any) => (
<tr
key={item.id}
onClick={() =>
router.push(`/reports/reports-view/?id=${item.id}`)
}
>
<td data-label='reason'>{item.reason}</td>
<td data-label='report_date'>
{dataFormatter.dateTimeFormatter(item.report_date)}
</td>
</tr>
))}
</tbody>
</table>
</div>
{!users?.reports_reporter?.length && (
<div className={'text-center py-4'}>No data</div>
)}
</CardBox>
</>
<BaseDivider /> <BaseDivider />
<BaseButton <BaseButton

View File

@ -5,15 +5,15 @@ import authSlice from './authSlice';
import openAiSlice from './openAiSlice'; import openAiSlice from './openAiSlice';
import usersSlice from './users/usersSlice'; import usersSlice from './users/usersSlice';
import commentsSlice from './comments/commentsSlice';
import duetsSlice from './duets/duetsSlice';
import likesSlice from './likes/likesSlice';
import notificationsSlice from './notifications/notificationsSlice';
import playlistsSlice from './playlists/playlistsSlice';
import reportsSlice from './reports/reportsSlice';
import songsSlice from './songs/songsSlice'; import songsSlice from './songs/songsSlice';
import duetsSlice from './duets/duetsSlice';
import playlistsSlice from './playlists/playlistsSlice';
import notificationsSlice from './notifications/notificationsSlice';
import likesSlice from './likes/likesSlice';
import commentsSlice from './comments/commentsSlice';
import tipsSlice from './tips/tipsSlice'; import tipsSlice from './tips/tipsSlice';
import rolesSlice from './roles/rolesSlice'; import rolesSlice from './roles/rolesSlice';
import reportsSlice from './reports/reportsSlice';
import permissionsSlice from './permissions/permissionsSlice'; import permissionsSlice from './permissions/permissionsSlice';
export const store = configureStore({ export const store = configureStore({
@ -24,15 +24,15 @@ export const store = configureStore({
openAi: openAiSlice, openAi: openAiSlice,
users: usersSlice, users: usersSlice,
comments: commentsSlice,
duets: duetsSlice,
likes: likesSlice,
notifications: notificationsSlice,
playlists: playlistsSlice,
reports: reportsSlice,
songs: songsSlice, songs: songsSlice,
duets: duetsSlice,
playlists: playlistsSlice,
notifications: notificationsSlice,
likes: likesSlice,
comments: commentsSlice,
tips: tipsSlice, tips: tipsSlice,
roles: rolesSlice, roles: rolesSlice,
reports: reportsSlice,
permissions: permissionsSlice, permissions: permissionsSlice,
}, },
}); });