Compare commits

..

No commits in common. "ai-dev" and "master" have entirely different histories.

17 changed files with 1051 additions and 1541 deletions

5
.gitignore vendored
View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@ -1,36 +0,0 @@
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,6 +66,14 @@ 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
db.songs.hasMany(db.comments, {
as: 'comments_song',
foreignKey: {
name: 'songId',
},
constraints: false,
});
db.songs.hasMany(db.duets, {
as: 'duets_original_song',
foreignKey: {
@ -82,14 +90,6 @@ module.exports = function (sequelize, DataTypes) {
constraints: false,
});
db.songs.hasMany(db.comments, {
as: 'comments_song',
foreignKey: {
name: 'songId',
},
constraints: false,
});
db.songs.hasMany(db.reports, {
as: 'reports_reported_content',
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
db.users.hasMany(db.songs, {
as: 'songs_artist',
db.users.hasMany(db.comments, {
as: 'comments_user',
foreignKey: {
name: 'artistId',
name: 'userId',
},
constraints: false,
});
@ -118,10 +118,10 @@ module.exports = function (sequelize, DataTypes) {
constraints: false,
});
db.users.hasMany(db.playlists, {
as: 'playlists_creator',
db.users.hasMany(db.likes, {
as: 'likes_user',
foreignKey: {
name: 'creatorId',
name: 'userId',
},
constraints: false,
});
@ -134,18 +134,26 @@ module.exports = function (sequelize, DataTypes) {
constraints: false,
});
db.users.hasMany(db.likes, {
as: 'likes_user',
db.users.hasMany(db.playlists, {
as: 'playlists_creator',
foreignKey: {
name: 'userId',
name: 'creatorId',
},
constraints: false,
});
db.users.hasMany(db.comments, {
as: 'comments_user',
db.users.hasMany(db.reports, {
as: 'reports_reporter',
foreignKey: {
name: 'userId',
name: 'reporterId',
},
constraints: false,
});
db.users.hasMany(db.songs, {
as: 'songs_artist',
foreignKey: {
name: 'artistId',
},
constraints: false,
});
@ -166,14 +174,6 @@ module.exports = function (sequelize, DataTypes) {
constraints: false,
});
db.users.hasMany(db.reports, {
as: 'reports_reporter',
foreignKey: {
name: 'reporterId',
},
constraints: false,
});
//end loop
db.users.belongsTo(db.roles, {

View File

@ -100,15 +100,15 @@ module.exports = {
const entities = [
'users',
'songs',
'duets',
'playlists',
'notifications',
'likes',
'comments',
'duets',
'likes',
'notifications',
'playlists',
'reports',
'songs',
'tips',
'roles',
'reports',
'permissions',
,
];
@ -232,105 +232,112 @@ primary key ("roles_permissionsId", "permissionId")
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_SONGS'),
permissionId: getId('CREATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_SONGS'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_SONGS'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_SONGS'),
permissionId: getId('DELETE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_SONGS'),
permissionId: getId('CREATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_SONGS'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_SONGS'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_SONGS'),
permissionId: getId('DELETE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_SONGS'),
permissionId: getId('CREATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_SONGS'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('DELETE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('CREATE_SONGS'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_SONGS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_SONGS'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('READ_SONGS'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_SONGS'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
@ -442,105 +449,98 @@ primary key ("roles_permissionsId", "permissionId")
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_PLAYLISTS'),
permissionId: getId('CREATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_PLAYLISTS'),
permissionId: getId('READ_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_PLAYLISTS'),
permissionId: getId('UPDATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_PLAYLISTS'),
permissionId: getId('DELETE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_PLAYLISTS'),
permissionId: getId('CREATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_PLAYLISTS'),
permissionId: getId('READ_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_PLAYLISTS'),
permissionId: getId('UPDATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_PLAYLISTS'),
permissionId: getId('DELETE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_PLAYLISTS'),
permissionId: getId('READ_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_PLAYLISTS'),
permissionId: getId('UPDATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('CREATE_PLAYLISTS'),
permissionId: getId('READ_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_PLAYLISTS'),
permissionId: getId('UPDATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('READ_PLAYLISTS'),
permissionId: getId('READ_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_PLAYLISTS'),
permissionId: getId('UPDATE_LIKES'),
},
{
@ -631,210 +631,322 @@ primary key ("roles_permissionsId", "permissionId")
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_LIKES'),
permissionId: getId('CREATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_LIKES'),
permissionId: getId('READ_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_LIKES'),
permissionId: getId('UPDATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_LIKES'),
permissionId: getId('DELETE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_LIKES'),
permissionId: getId('CREATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_LIKES'),
permissionId: getId('READ_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_LIKES'),
permissionId: getId('UPDATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_LIKES'),
permissionId: getId('DELETE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_LIKES'),
permissionId: getId('READ_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_LIKES'),
permissionId: getId('UPDATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_LIKES'),
permissionId: getId('CREATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('READ_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('CREATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('MusicManager'),
permissionId: getId('DELETE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('CREATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('ContentCurator'),
permissionId: getId('DELETE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('CREATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('CommunityModerator'),
permissionId: getId('DELETE_COMMENTS'),
permissionId: getId('READ_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('READ_COMMENTS'),
permissionId: getId('UPDATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('READ_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_PLAYLISTS'),
},
{
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('UPDATE_COMMENTS'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('VerifiedArtist'),
permissionId: getId('UPDATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('READ_COMMENTS'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Listener'),
permissionId: getId('UPDATE_COMMENTS'),
permissionId: getId('UPDATE_REPORTS'),
},
{
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'),
},
{
@ -921,118 +1033,6 @@ primary key ("roles_permissionsId", "permissionId")
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,
updatedAt,
@ -1097,25 +1097,25 @@ primary key ("roles_permissionsId", "permissionId")
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_SONGS'),
permissionId: getId('CREATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_SONGS'),
permissionId: getId('READ_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_SONGS'),
permissionId: getId('UPDATE_COMMENTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_SONGS'),
permissionId: getId('DELETE_COMMENTS'),
},
{
@ -1147,25 +1147,25 @@ primary key ("roles_permissionsId", "permissionId")
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_PLAYLISTS'),
permissionId: getId('CREATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_PLAYLISTS'),
permissionId: getId('READ_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_PLAYLISTS'),
permissionId: getId('UPDATE_LIKES'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_PLAYLISTS'),
permissionId: getId('DELETE_LIKES'),
},
{
@ -1197,50 +1197,75 @@ primary key ("roles_permissionsId", "permissionId")
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_LIKES'),
permissionId: getId('CREATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_LIKES'),
permissionId: getId('READ_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_LIKES'),
permissionId: getId('UPDATE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_LIKES'),
permissionId: getId('DELETE_PLAYLISTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('CREATE_COMMENTS'),
permissionId: getId('CREATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('READ_COMMENTS'),
permissionId: getId('READ_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('UPDATE_COMMENTS'),
permissionId: getId('UPDATE_REPORTS'),
},
{
createdAt,
updatedAt,
roles_permissionsId: getId('Administrator'),
permissionId: getId('DELETE_COMMENTS'),
permissionId: getId('DELETE_REPORTS'),
},
{
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'),
},
{
@ -1293,31 +1318,6 @@ primary key ("roles_permissionsId", "permissionId")
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,
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 songsRoutes = require('./routes/songs');
const commentsRoutes = require('./routes/comments');
const duetsRoutes = require('./routes/duets');
const playlistsRoutes = require('./routes/playlists');
const likesRoutes = require('./routes/likes');
const notificationsRoutes = require('./routes/notifications');
const likesRoutes = require('./routes/likes');
const playlistsRoutes = require('./routes/playlists');
const commentsRoutes = require('./routes/comments');
const reportsRoutes = require('./routes/reports');
const songsRoutes = require('./routes/songs');
const tipsRoutes = require('./routes/tips');
const rolesRoutes = require('./routes/roles');
const reportsRoutes = require('./routes/reports');
const permissionsRoutes = require('./routes/permissions');
const getBaseUrl = (url) => {
@ -113,9 +113,9 @@ app.use(
);
app.use(
'/api/songs',
'/api/comments',
passport.authenticate('jwt', { session: false }),
songsRoutes,
commentsRoutes,
);
app.use(
@ -125,9 +125,9 @@ app.use(
);
app.use(
'/api/playlists',
'/api/likes',
passport.authenticate('jwt', { session: false }),
playlistsRoutes,
likesRoutes,
);
app.use(
@ -137,15 +137,21 @@ app.use(
);
app.use(
'/api/likes',
'/api/playlists',
passport.authenticate('jwt', { session: false }),
likesRoutes,
playlistsRoutes,
);
app.use(
'/api/comments',
'/api/reports',
passport.authenticate('jwt', { session: false }),
commentsRoutes,
reportsRoutes,
);
app.use(
'/api/songs',
passport.authenticate('jwt', { session: false }),
songsRoutes,
);
app.use(
@ -160,12 +166,6 @@ app.use(
rolesRoutes,
);
app.use(
'/api/reports',
passport.authenticate('jwt', { session: false }),
reportsRoutes,
);
app.use(
'/api/permissions',
passport.authenticate('jwt', { session: false }),

View File

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

View File

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

View File

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

View File

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

View File

@ -166,6 +166,49 @@ const SongsView = () => {
</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>
<CardBox
@ -240,49 +283,6 @@ const SongsView = () => {
</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>
<CardBox

View File

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

View File

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