Skip to content

Commit

Permalink
socioboard 3.0 update
Browse files Browse the repository at this point in the history
socioboard 3.0 update
  • Loading branch information
swetasb committed Feb 8, 2018
1 parent 7ee1091 commit 6669416
Show file tree
Hide file tree
Showing 42 changed files with 1,831 additions and 480 deletions.
8 changes: 8 additions & 0 deletions src/Api.Socioboard/Controllers/InstagramController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,13 @@ public IActionResult followpeople(string instagramId ,string followingid)
return Ok(Searchdata);

}

[HttpGet("GetInstaAccSingle")]
public IActionResult GetInstaAccSingle(string accId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
Domain.Socioboard.Models.Instagramaccounts pageDetails = dbr.Single<Domain.Socioboard.Models.Instagramaccounts>(t => t.InstagramId == accId);
return Ok(pageDetails);
}
}
}
12 changes: 11 additions & 1 deletion src/Api.Socioboard/Controllers/SavedFeedsManagementController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Api.Socioboard.Model;
using Api.Socioboard.Helper;
using Api.Socioboard.Model;
using Api.Socioboard.Repositories;
using Domain.Socioboard.Interfaces.Services;
using Domain.Socioboard.Models.Mongo;
Expand Down Expand Up @@ -39,6 +40,10 @@ public SavedFeedsManagementController(ILogger<UserController> logger, IEmailSend
[HttpPost("SavePost")]
public IActionResult SavePost(SavedFeedsManagement objData, IFormFile files)
{
if (files != null)
{
objData.url = MediaHelper.UploadMedia(files, _appSettings, _appEnv);
}
bool status = SavedFeedsManagementRepository.SavePost(objData, _appSettings);
return Ok(status);
}
Expand Down Expand Up @@ -69,5 +74,10 @@ public IActionResult GetSavedFeeds(string profileId,long groupId)
return Ok(SavedFeedsManagementRepository.GetSavedFeeds(profileId, groupId, _appSettings));
}

[HttpGet("GetComments")]
public IActionResult GetComments(string postId, long groupId)
{
return Ok(SavedFeedsManagementRepository.GetComments(postId, groupId, _appSettings));
}
}
}
4 changes: 2 additions & 2 deletions src/Api.Socioboard/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ public IActionResult ResendMail(string Email)
html = html.Replace("[ActivationLink]", _appSettings.Domain + "/Home/Active?Token=" + user.EmailValidateToken + "&id=" + user.Id);


_emailSender.SendMailSendGrid(_appSettings.frommail, "", user.EmailId, "", "", "Socioboard Email conformation Link", html, _appSettings.SendgridUserName, _appSettings.SendGridPassword);
_emailSender.SendMailSendGrid(_appSettings.frommail, "", user.EmailId, "", "", "Socioboard Email confirmation Link", html, _appSettings.SendgridUserName, _appSettings.SendGridPassword);

return Ok("Mail Sent Successfully.");
}
Expand Down Expand Up @@ -2191,7 +2191,7 @@ public IActionResult ChangeEmailID(long userId, string newEmailID, string confir
}
else
{
return BadRequest("New Email and Conform Email are not same");
return BadRequest("New Email and Confirm Email are not same");
}

}
Expand Down
42 changes: 42 additions & 0 deletions src/Api.Socioboard/Helper/MediaHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace Api.Socioboard.Helper
{
public class MediaHelper
{
public static string UploadMedia(IFormFile files, Helper.AppSettings _appSettings, IHostingEnvironment _appEnv)
{
var filename = string.Empty;
var uploads = string.Empty;
var fileName = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue.Parse(files.ContentDisposition).FileName.Trim('"');
filename = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue
.Parse(files.ContentDisposition)
.FileName
.Trim('"');
var tempName = Domain.Socioboard.Helpers.SBHelper.RandomString(10) + '.' + fileName.Split('.')[1];

filename = _appEnv.WebRootPath + "\\upload" + $@"\{tempName}";
uploads = _appSettings.ApiDomain + "/api/Media/get?id=" + $@"{tempName}";
try
{
using (FileStream fs = System.IO.File.Create(filename))
{
files.CopyTo(fs);
fs.Flush();
}
filename = uploads;
return filename;
}
catch (System.Exception ex)
{
return null;
}
}
}
}
39 changes: 32 additions & 7 deletions src/Api.Socioboard/Repositories/ContentStudioRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,15 @@ public static string saveContentDataIdReposi(List<Domain.Socioboard.Models.Mongo


int totalval = 0;
// DateTime timeval = DateTime.Now;
foreach (var fbid in lstProfileIds)
{

Domain.Socioboard.Models.Facebookaccounts listfb = dbr.FindSingle<Domain.Socioboard.Models.Facebookaccounts>(t => t.FbUserId == fbid);
int countval = 0;
int countitem = 0;
string timevalue = null;
string sectimevalue = null;
foreach (var item in shareathon)
{

Expand All @@ -309,28 +312,34 @@ public static string saveContentDataIdReposi(List<Domain.Socioboard.Models.Mongo
lstIdforPost.UserId = listfb.UserId;
lstIdforPost.Timeintervalminutes = timeInterval;
lstIdforPost.postId = item.postId;
lstIdforPost.lastsharestamp = SBHelper.ConvertToUnixTimestamp(DateTime.UtcNow);
if (countitem==0)
{
lstIdforPost.lastsharestamp = SBHelper.ConvertToUnixTimestamp(DateTime.UtcNow);
lstIdforPost.latsSharetime = DateTime.UtcNow;
}
else
{
var result = TimeSpan.FromMinutes(timeInterval);
// a.AddMinutes
DateTime secval = Convert.ToDateTime(timevalue);
lstIdforPost.latsSharetime = secval.AddMinutes(timeInterval);//timevalue.latsSharetime.AddMinutes(timeInterval);
// var result = TimeSpan.FromMinutes(timeInterval);
// lstIdforPost.lastsharestamp = lstIdforPost.lastsharestamp + datetotimestamp;
countitem++;

}


try
{
mongoreposhareId.Add(lstIdforPost);
//countval++;

}
catch (Exception ex)
{
//return "not added";
}

DateTime timeval = lstIdforPost.latsSharetime;
timevalue =timeval.ToString();

}
int count = 0;
try
Expand Down Expand Up @@ -371,7 +380,19 @@ public static string saveContentDataIdReposi(List<Domain.Socioboard.Models.Mongo
lstforShareathon.UserId = userId;
lstforShareathon.Timeintervalminutes = timeInterval;
lstforShareathon.lastsharestamp = SBHelper.ConvertToUnixTimestamp(DateTime.UtcNow);

lstforShareathon.Status = false;
if (countitem == 0)
{
lstforShareathon.latsSharetime = DateTime.UtcNow;
}
else
{
// a.AddMinutes
DateTime sectableaddtime = Convert.ToDateTime(sectimevalue);
lstforShareathon.latsSharetime = sectableaddtime.AddMinutes(timeInterval);

}
try
{
mongorepo.Add(lstforShareathon);
Expand All @@ -381,12 +402,16 @@ public static string saveContentDataIdReposi(List<Domain.Socioboard.Models.Mongo
{
//return "not added";
}

DateTime timevalsec = lstforShareathon.latsSharetime;
sectimevalue = timevalsec.ToString();

}
else
{
// return "some problem while adding";
}

countitem++;
totalval = countval;
}
}
Expand Down
13 changes: 8 additions & 5 deletions src/Api.Socioboard/Repositories/FacebookRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ public static int AddFacebookPage(dynamic profile, Model.DatabaseRepository dbr,

new Thread(delegate ()
{
FacebookRepository.SaveFacebookPageFeed(fbAcc.AccessToken, lstFbAcc.First().FbUserId, lstFbAcc.First().FbUserName, settings);
FacebookRepository.SaveFacebookFeeds(fbAcc.AccessToken, lstFbAcc.First().FbUserId, settings, _logger);
FacebookRepository.SaveFacebookPageFeed(fbAcc.AccessToken, lstFbAcc.First().FbUserId, settings);
FacebookRepository.SavePageConversations(fbAcc.AccessToken, lstFbAcc.First().FbUserId, settings, _logger);
FacebookRepository.SaveFacebookPagePromotionalDetails(fbAcc.AccessToken, lstFbAcc.First().FbUserId, settings, _logger);
FacebookRepository.SaveFacebookPageTaggedDetails(fbAcc.AccessToken, lstFbAcc.First().FbUserId, settings, _logger);
Expand All @@ -368,7 +368,7 @@ public static int AddFacebookPage(dynamic profile, Model.DatabaseRepository dbr,
UpdateDeleteLinkShareathon(fbAcc.FbUserName, userId, settings);
}).Start();



}
}
Expand Down Expand Up @@ -993,7 +993,7 @@ public static void SavePageNotification(string AccessToken, string ProfileId, He
}
}

public static void SaveFacebookPageFeed(string accesstoken, string facebookid, Helper.AppSettings _appSettings)
public static void SaveFacebookPageFeed(string accesstoken, string facebookid,string fbpagename ,Helper.AppSettings _appSettings)
{
try
{
Expand All @@ -1011,7 +1011,10 @@ public static void SaveFacebookPageFeed(string accesstoken, string facebookid, H
{
_FacebookPagePost.PageName = _feed["from"]["name"].ToString();
}
catch { }
catch
{
_FacebookPagePost.PageName = fbpagename;
}
try
{
_FacebookPagePost.PostId = _feed["id"].ToString();
Expand Down Expand Up @@ -1178,7 +1181,7 @@ public static void SaveFacebookPageFeed(string accesstoken, string facebookid, H
{
var update = Builders<Domain.Socioboard.Models.Mongo.FacebookPagePost>.Update.Set(t => t.Likes, _FacebookPagePost.Likes).Set(t => t.Comments, _FacebookPagePost.Comments).Set(t => t.Shares, _FacebookPagePost.Shares)
.Set(t => t.EngagedUsers, _FacebookPagePost.EngagedUsers).Set(t => t.Talking, _FacebookPagePost.Talking).Set(t => t.Engagement, _FacebookPagePost.Engagement)
.Set(t => t.Reach, _FacebookPagePost.Reach).Set(t => t.Link, _FacebookPagePost.Link);
.Set(t => t.Reach, _FacebookPagePost.Reach).Set(t => t.Link, _FacebookPagePost.Link).Set(t => t.PageName, _FacebookPagePost.PageName);
reppoFacebookPagePost.Update<Domain.Socioboard.Models.Mongo.FacebookPagePost>(update, t => t.PostId == _FacebookPagePost.PostId);
}
else
Expand Down
22 changes: 22 additions & 0 deletions src/Api.Socioboard/Repositories/SavedFeedsManagementRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,27 @@ public static bool DeleteComment(string commentId, Helper.AppSettings _settings)
return null;
}
}

public static IList<Domain.Socioboard.Models.Mongo.SavedFeedsComments> GetComments(string postId, long groupId, Helper.AppSettings _settings)
{
MongoRepository mongorepo = new MongoRepository("SavedFeedsComments", _settings);
try
{
var builder = Builders<Domain.Socioboard.Models.Mongo.SavedFeedsComments>.Sort;
var sort = builder.Descending(t => t.savedTime);
var result = mongorepo.Find<Domain.Socioboard.Models.Mongo.SavedFeedsComments>(t => t.postId.Equals(postId) && t.groupId.Equals(groupId));
var task = Task.Run(async () =>
{
return await result;
});
IList<Domain.Socioboard.Models.Mongo.SavedFeedsComments> lstYtFeeds = task.Result;
return lstYtFeeds;
}
catch
{
return null;
}
}
}
}

3 changes: 2 additions & 1 deletion src/Domain.Socioboard/Enum/ScheduleStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public enum ScheduleStatus
{
Compleated=1,
Pending=0,
Deleted=2
Deleted=2,
error = 3
}
}
15 changes: 15 additions & 0 deletions src/Domain.Socioboard/Enum/ScheduledStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Domain.Socioboard.Enum
{
public enum ScheduledStatus
{
Default = 0,
Scheduled = 1,
Published = 2,
Deleted = 3
}
}
2 changes: 2 additions & 0 deletions src/Domain.Socioboard/Models/Mongo/AdvanceSerachData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class AdvanceSerachData
public string domainType { get; set; }
public string title { get; set; }
public string userName { get; set; }
public string country { get; set; }
public string language { get; set; }
public string videourl { get; set; }
public double postedTime { get; set; }
public string publishDate { get; set; }
Expand Down
5 changes: 3 additions & 2 deletions src/Domain.Socioboard/Models/Mongo/ContentFeedsShareathon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public class ContentFeedsShareathon
public string postUrl { get; set; }
public double postedTime { get; set; }
public bool Status { get; set; }
public virtual int Timeintervalminutes { get; set; }
public virtual double lastsharestamp { get; set; }
public DateTime latsSharetime { get; set; }
public int Timeintervalminutes { get; set; }
public double lastsharestamp { get; set; }

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public class ContentStudioShareathonIdData
public string postId { get; set; }

public bool Status { get; set; }
public virtual int Timeintervalminutes { get; set; }
public virtual double lastsharestamp { get; set; }
public int Timeintervalminutes { get; set; }
public double lastsharestamp { get; set; }
public DateTime latsSharetime { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Domain.Socioboard.Helpers;
using Domain.Socioboard.Enum;
using Domain.Socioboard.Helpers;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Newtonsoft.Json;
Expand All @@ -17,11 +18,14 @@ public class FacebookPasswordChangeUserDetail
public string strId { get; set; }
public long userId { get; set; }
public string userPrimaryEmail { get; set; }
public string fbAccEmail { get; set; }
public string profileId { get; set; }
public string profileName { get; set; }
public string message { get; set; }
public string dateValue { get; set; }
public bool status { get; set; }
public string socialmedia { get; set; }
public SBRegistrationType RegistrationType { get; set; }



Expand Down
1 change: 1 addition & 0 deletions src/Domain.Socioboard/Models/Mongo/MongoYoutubeComments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class MongoYoutubeComments
public bool sbGrpTaskAssign { get; set; }
public bool review { get; set; }
public string reviewedBy { get; set; }
public double reviewedBysbUserId { get; set; }


}
Expand Down
30 changes: 30 additions & 0 deletions src/Domain.Socioboard/Models/Mongo/SavedFeedsComments.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Domain.Socioboard.Enum;
using Domain.Socioboard.Helpers;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Domain.Socioboard.Models.Mongo
{
[BsonIgnoreExtraElements]
public class SavedFeedsComments
{
[BsonId]
[JsonConverter(typeof(ObjectIdConverter))]
public ObjectId commentId { get; set; }
public string postId { get; set; }
public string profileId { get; set; }
public string commentText { get; set; }
public double savedTime { get; set; }
public long userId { get; set; }
public long groupId { get; set; }
public string userProfilePic { get; set; }
public string userName { get; set; }
public bool updateCommentStatus { get; set; }

}
}
Loading

0 comments on commit 6669416

Please sign in to comment.