public bool UserHasMaxRegularsInQueue(string username) { var maxRegulars = _configService.Get <int>("MaxRegularSongsPerUser"); var usersRegulars = _getUsersCurrentRequestCountsQuery.GetUsersCurrentRequestCounts(username, SongRequestType.Regular); return(usersRegulars >= maxRegulars); }
public async Task <bool> RemoveRockRequests(string username, string commandText, bool isMod) { bool success = false; // If the command text doesn't parse, we should attempt to remove a regular request if (!int.TryParse(commandText.Trim(), out var playlistIndex)) { // remove regular request if it exists if (_getUsersCurrentRequestCountsQuery.GetUsersCurrentRequestCounts(username, SongRequestType.Regular) == 1) { success = await _archiveUsersSingleRequestCommand.ArchiveAndRefundVips(username, SongRequestType.Regular, _currentRequest.songRequestId).ConfigureAwait(false); } // if true return, otherwise attempt to remove and refund a single vip else if (_getUsersCurrentRequestCountsQuery.GetUsersCurrentRequestCounts(username, SongRequestType.Vip) == 1) { success = await _archiveUsersSingleRequestCommand.ArchiveAndRefundVips(username, SongRequestType.Vip, _currentRequest.songRequestId).ConfigureAwait(false); } else if (_getUsersCurrentRequestCountsQuery.GetUsersCurrentRequestCounts(username, SongRequestType.SuperVip) == 1) { success = await _archiveUsersSingleRequestCommand.ArchiveAndRefundVips(username, SongRequestType.SuperVip, _currentRequest.songRequestId).ConfigureAwait(false); } // TODO SignalR Update return(success); } // Remove VIP request using provided playlistIndex. // Query can use existing GetUsersRequestsRepository to get the song request id success = await _removeUsersRequestByPlaylistIndexCommand.Remove(username, playlistIndex).ConfigureAwait(false); UpdateFullPlaylist(); // TODO SignalR Update return(success); }