Skip to content

Commit

Permalink
socioboard 3.0
Browse files Browse the repository at this point in the history
Github Commit
------------------
-Fixed feeds data issue
-Fixed authentication issue
-Fixedsocial signin issue
-Fixed create board issue
-Fixed notification issue
-Fixed team Conneted Profile issue
-Fixed show all profiles for team
-Fixed Logout issue
  • Loading branch information
socioboard committed Oct 3, 2017
1 parent 8b67858 commit 99305bb
Show file tree
Hide file tree
Showing 189 changed files with 4,162 additions and 1,083 deletions.
Binary file modified .vs/Socioboard/v14/.suo
Binary file not shown.
98 changes: 98 additions & 0 deletions src/Api.Socioboard/Controllers/BoardMeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,60 @@ public IActionResult getBoardByName(string boardName)
}
}

[HttpGet("getBoardFeedsByName")]
public IActionResult getBoardFeedsByName(string boardName)
{
//boardName = boardName.Replace("SB", "/");
try
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<Domain.Socioboard.Models.MongoBoards> lstboard = dbr.Find<Domain.Socioboard.Models.MongoBoards>(t => t.TempboardName == boardName).ToList();
if (lstboard.Count > 1)
{
foreach (Domain.Socioboard.Models.MongoBoards brd in lstboard)
{
if (brd.facebookHashTag != null)
{
return Ok(BoardMeRepository.getBoardFeedsByName(brd.boardId, _redisCache, _appSettings, _logger, dbr));
}
}
return Ok();
}
else if(lstboard.Count ==1)
{
return Ok(BoardMeRepository.getBoardByName(lstboard.First().boardName, _redisCache, _appSettings, _logger, dbr));
}
else
{
return Ok();
}
}
catch(Exception ex)
{
Console.WriteLine(ex.StackTrace);
return BadRequest("Something Went Wrong");
}

//try
//{
// Domain.Socioboard.Models.MongoBoards board = dbr.Single<Domain.Socioboard.Models.MongoBoards>(t => t.TempboardName == boardName);
// if(board!=null)
// {
// return Ok(BoardMeRepository.getBoardByName(board.boardName, _redisCache, _appSettings, _logger, dbr));
// }
// else
// {
// return Ok();
// }

//}
//catch (Exception ex)
//{
// Console.WriteLine(ex.StackTrace);
// return BadRequest("Something Went Wrong");
//}
}

[HttpGet("getAnalytics")]
public IActionResult getAnalytics(string boardId)
{
Expand Down Expand Up @@ -411,6 +465,50 @@ public IActionResult getTopTrending()
return BadRequest("Something Went Wrong");
}
}
[HttpGet("getWeeklyTrending")]
public IActionResult getWeeklyTrending()
{
try
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
return Ok(BoardMeRepository.getweeklyTrending(_redisCache, _appSettings, _logger, dbr));
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return BadRequest("Something Went Wrong");
}
}

[HttpGet("getmonthlyTrending")]
public IActionResult getmonthlyTrending()
{
try
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
return Ok(BoardMeRepository.getMonthlyTrending(_redisCache, _appSettings, _logger, dbr));
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return BadRequest("Something Went Wrong");
}
}

[HttpGet("getyearlyTrending")]
public IActionResult getyearlyTrending()
{
try
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
return Ok(BoardMeRepository.getyearlyTrending(_redisCache, _appSettings, _logger, dbr));
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return BadRequest("Something Went Wrong");
}
}

[HttpGet("AddTOSiteMap")]
public IActionResult AddTOSiteMap(string boardName)
Expand Down
120 changes: 83 additions & 37 deletions src/Api.Socioboard/Controllers/FacebookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,35 +117,43 @@ public IActionResult ReconnectFbAccount(string accessToken, long groupId, long u
Domain.Socioboard.Models.Facebookaccounts fbaccw = Api.Socioboard.Repositories.FacebookRepository.getFacebookAccount(profileId, _redisCache, dbr);
//fbacc = fbacc.Where(t => t.FbUserId.Contains("127471161024815")).ToList();


if (fbacc.FbUserId == profileId)
try
{
if (fbacc != null && fbacc.IsActive == true)
if (fbacc.FbUserId == profileId)
{
if (fbacc.UserId == userId)
if (fbacc != null && fbacc.IsActive == true)
{
Groups ngrp = dbr.Find<Domain.Socioboard.Models.Groups>(t => t.adminId == userId && t.id == groupId).FirstOrDefault();
if (ngrp == null)
{
return Ok("Wrong Group Id");
}
int res = Api.Socioboard.Repositories.FacebookRepository.ReFacebookAccount(profile, FbUser.getFbFriends(accessToken), dbr, userId, ngrp.id, Domain.Socioboard.Enum.FbProfileType.FacebookProfile, accessToken, reconnect, _redisCache, _appSettings, _logger);
if (res == 1)
{
return Ok("Facebook account Reconnect Successfully");
}
else
if (fbacc.UserId == userId)
{
return Ok("Error while Reconnecting Account");
Groups ngrp = dbr.Find<Domain.Socioboard.Models.Groups>(t => t.adminId == userId && t.id == groupId).FirstOrDefault();
if (ngrp == null)
{
return Ok("Wrong Group Id");
}
int res = Api.Socioboard.Repositories.FacebookRepository.ReFacebookAccount(profile, FbUser.getFbFriends(accessToken), dbr, userId, ngrp.id, Domain.Socioboard.Enum.FbProfileType.FacebookProfile, accessToken, reconnect, _redisCache, _appSettings, _logger);
if (res == 1)
{
return Ok("Facebook account Reconnect Successfully");
}
else
{
return Ok("Error while Reconnecting Account");
}
}
}

}
}
else
{
return Ok("Oops! login information is wrong , login the profile which has to be reconnected");
}
}
else
catch (Exception ex)
{
return Ok("Oops! login information is wrong , login the profile which has to be reconnected");
}



return Ok();

Expand Down Expand Up @@ -288,24 +296,24 @@ public IActionResult GetTopFeeds(string profileId, long userId, int skip, int co
});
IList<Domain.Socioboard.Models.Mongo.MongoFacebookFeed> lstFbFeeds = task.Result;

//foreach (var item in lstFbFeeds.ToList())
//{
// Domain.Socioboard.Models.Mongo.facebookfeed _intafeed = new Domain.Socioboard.Models.Mongo.facebookfeed();
// MongoRepository mongorepocomment = new MongoRepository("MongoFbPostComment", _appSettings);
// var buildecommentr = Builders<Domain.Socioboard.Models.Mongo.MongoFbPostComment>.Sort;
// var sortcomment = buildecommentr.Descending(t => t.Likes);
// var resultcomment = mongorepocomment.FindWithRange<Domain.Socioboard.Models.Mongo.MongoFbPostComment>(t => t.PostId == item.FeedId, sortcomment, skip,5);
// var taskcomment = Task.Run(async () =>
// {
// return await resultcomment;
// });
// IList<Domain.Socioboard.Models.Mongo.MongoFbPostComment> lstFbPostComment = taskcomment.Result;
// lstFbPostComment = lstFbPostComment.OrderByDescending(t => t.Commentdate).ToList();
// _intafeed._facebookFeed = item;
// _intafeed._facebookComment = lstFbPostComment.ToList();
// lstfacebookfeed.Add(_intafeed);
//}
return Ok(lstFbFeeds.ToList());
foreach (var item in lstFbFeeds.ToList())
{
Domain.Socioboard.Models.Mongo.facebookfeed _intafeed = new Domain.Socioboard.Models.Mongo.facebookfeed();
MongoRepository mongorepocomment = new MongoRepository("MongoFbPostComment", _appSettings);
var buildecommentr = Builders<Domain.Socioboard.Models.Mongo.MongoFbPostComment>.Sort;
var sortcomment = buildecommentr.Descending(t => t.Likes);
var resultcomment = mongorepocomment.FindWithRange<Domain.Socioboard.Models.Mongo.MongoFbPostComment>(t => t.PostId == item.FeedId, sortcomment, skip, 5);
var taskcomment = Task.Run(async () =>
{
return await resultcomment;
});
IList<Domain.Socioboard.Models.Mongo.MongoFbPostComment> lstFbPostComment = taskcomment.Result;
lstFbPostComment = lstFbPostComment.OrderByDescending(t => t.Commentdate).ToList();
_intafeed._facebookFeed = item;
_intafeed._facebookComment = lstFbPostComment.ToList();
lstfacebookfeed.Add(_intafeed);
}
return Ok(lstfacebookfeed.ToList());

}
// return Ok();
Expand Down Expand Up @@ -376,6 +384,24 @@ public IActionResult GetAllFacebookProfiles(long groupId)
return Ok(lstFbAcc);
}

[HttpGet("GetFacebookProfilesOnlyforReconn")]
public IActionResult GetFacebookProfilesOnlyforReconn(long groupId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<Domain.Socioboard.Models.Groupprofiles> lstGrpProfiles = Repositories.GroupProfilesRepository.getAllGroupProfiles(groupId, _redisCache, dbr);
List<Domain.Socioboard.Models.Facebookaccounts> lstFbAcc = new List<Facebookaccounts>();
foreach (var item in lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.Facebook))
{
Domain.Socioboard.Models.Facebookaccounts fbAcc = Repositories.FacebookRepository.getFacebookAccount(item.profileId, _redisCache, dbr);
Domain.Socioboard.Models.User userdata = dbr.Single<Domain.Socioboard.Models.User>(t => t.Id == fbAcc.UserId);
if (fbAcc != null)
{
lstFbAcc.Add(fbAcc);
}
}
return Ok(lstFbAcc);
}

[HttpGet("GetFacebookProfilesOnly")]
public IActionResult GetFacebookProfilesOnly(long groupId)
{
Expand All @@ -385,14 +411,34 @@ public IActionResult GetFacebookProfilesOnly(long groupId)
foreach (var item in lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.Facebook))
{
Domain.Socioboard.Models.Facebookaccounts fbAcc = Repositories.FacebookRepository.getFacebookAccount(item.profileId, _redisCache, dbr);
if (fbAcc != null)
Domain.Socioboard.Models.User userdata = dbr.Single<Domain.Socioboard.Models.User>(t => t.Id == fbAcc.UserId);
if (fbAcc != null && userdata.EmailId != fbAcc.EmailId)
{
lstFbAcc.Add(fbAcc);
}
}
return Ok(lstFbAcc);
}

[HttpGet("GetPrimaryFacebookAcc")]
public IActionResult GetPrimaryFacebookAcc(long userId, long groupId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<Domain.Socioboard.Models.Groupprofiles> lstGrpProfiles = Repositories.GroupProfilesRepository.getAllGroupProfiles(groupId, _redisCache, dbr);
//List<Domain.Socioboard.Models.Facebookaccounts> lstFbAcc = new List<Facebookaccounts>();
Domain.Socioboard.Models.Facebookaccounts UserFbAccDetail = new Facebookaccounts();
foreach (var item in lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.Facebook))
{
Domain.Socioboard.Models.Facebookaccounts fbAcc = Repositories.FacebookRepository.getFacebookAccount(item.profileId, _redisCache, dbr);
Domain.Socioboard.Models.User userdata = dbr.Single<Domain.Socioboard.Models.User>(t => t.Id == fbAcc.UserId);
if (fbAcc != null && userdata.EmailId == fbAcc.EmailId)
{
UserFbAccDetail = fbAcc;
}
}
return Ok(UserFbAccDetail);
}

[HttpPost("GetFacebookPages")]
public IActionResult GetFacebookPages(string accesstoken, long groupId)
{
Expand Down
Loading

0 comments on commit 99305bb

Please sign in to comment.