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 Mar 12, 2018
1 parent 4eb9cf0 commit 6997f4b
Show file tree
Hide file tree
Showing 18 changed files with 831 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ public IActionResult aprove(string strid ,bool update)
}

//ScheduleMsg
[HttpPost("ScheduleMsg")]
public IActionResult ScheduleMsg(string postId, long groupId ,string schtime)
[HttpGet("ScheduleMsg")]
public IActionResult ScheduleMsg(string postId, long groupId ,DateTime schtime,string timeval)
{
bool status = SavedFeedsManagementRepository.scheduleMsgRepo(postId, groupId, schtime, _appSettings);
bool status = SavedFeedsManagementRepository.scheduleMsgRepo(postId, groupId, schtime, timeval, _appSettings);
return Ok(status);
}
}
Expand Down
34 changes: 17 additions & 17 deletions src/Api.Socioboard/Controllers/TwitterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,23 +521,23 @@ public IActionResult GettwitterSingle(string profileId)

}

// [HttpPost("publish")]
//public IActionResult publish(string profileId,string twitterText, long userId , string imgUrl ,string strid)
//{
// DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
// string ret = Helper.TwitterHelper.PostTwitterMessage(_appSettings, _redisCache, twitterText, profileId, userId, imgUrl, true, 0, "", dbr, _logger);
// if (ret =="")
// {
// string responce = SavedFeedsManagementRepository.publish( profileId, strid, _appSettings);
[HttpPost("publish")]
public IActionResult publish(string profileId, string twitterText, long userId, string imgUrl, string strid)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
string ret = Helper.TwitterHelper.PostTwitterMessage(_appSettings, _redisCache, twitterText, profileId, userId, imgUrl, true, 0, "", dbr, _logger);
if (ret == "")
{
string responce = SavedFeedsManagementRepository.publish(profileId, strid, _appSettings);

return Ok(responce);
}
else
{
return Ok("failed");
}

// return Ok(responce);
// }
// else
// {
// return Ok("failed");
// }


// }
}
}
}
}
19 changes: 16 additions & 3 deletions src/Api.Socioboard/Repositories/SavedFeedsManagementRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;

Expand All @@ -17,6 +18,7 @@ public static bool SavePost(SavedFeedsManagement objDta, Helper.AppSettings _set
{
objDta.Id = ObjectId.GenerateNewId();
objDta.strId = ObjectId.GenerateNewId().ToString();
objDta.postId = ObjectId.GenerateNewId().ToString();
objDta.savedTime = Helper.DateExtension.ConvertToUnixTimestamp(DateTime.UtcNow);
MongoRepository mongorepo = new MongoRepository("SavedFeedsManagement", _settings);
var result = mongorepo.Add<Domain.Socioboard.Models.Mongo.SavedFeedsManagement>(objDta);
Expand Down Expand Up @@ -168,15 +170,26 @@ public static string publish(string profileId, string strid, Helper.AppSettings
}


public static bool scheduleMsgRepo(string postId, long groupId,string schtime, Helper.AppSettings _settings)
public static bool scheduleMsgRepo(string postId, long groupId,DateTime schtime,string timeval, Helper.AppSettings _settings)
{

MongoRepository mongorepo = new MongoRepository("SavedFeedsManagement", _settings);
try
{
string dateval = schtime.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
DateTime schdatetime = Convert.ToDateTime(dateval + " " + timeval);


FilterDefinition<BsonDocument> filter = new BsonDocument("postId", postId);
var update = Builders<BsonDocument>.Update.Set("scheduleTime", schtime);
mongorepo.Update<MongoYoutubeComments>(update, filter);
var update = Builders<BsonDocument>.Update.Set("scheduleTime", schdatetime).Set("schedOrNotstatus", 1).Set("scheduleTimestr", schdatetime.ToString());
try
{
mongorepo.Update<SavedFeedsManagement>(update, filter);
}
catch (Exception ex)
{

}
return true;
}
catch
Expand Down
16 changes: 16 additions & 0 deletions src/Domain.Socioboard/Enum/ScheduledStatusFeedsManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Domain.Socioboard.Enum
{
public enum ScheduledStatusFeedsManager
{
Default = 0,
Scheduled = 1,
Published = 2,
Deleted = 3,
error = 4
}
}
11 changes: 9 additions & 2 deletions src/Domain.Socioboard/Models/Mongo/SavedFeedsManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ public class SavedFeedsManagement
[JsonConverter(typeof(ObjectIdConverter))]
public ObjectId Id { get; set; }
public string strId { get; set; }
public string postId { get; set; }
public string shareMessage { get; set; }
public string postLink { get; set; }
public double savedTime { get; set; }
public ScheduledStatus status { get; set; }
public ScheduledStatusFeedsManager status { get; set; }
public bool review { get; set; }
public long userId { get; set; }
public string sbuserName { get; set; }
Expand All @@ -34,6 +35,12 @@ public class SavedFeedsManagement
public string link { get; set; }
public double calenderTime { get; set; }
public MediaType mediaType { get; set; }

public DateTime scheduleTime { get; set; }
public string scheduleTimestr { get; set; }

public int schedOrNotstatus { get; set; }



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SocioboardApp.controller('FacebookFeedsManagerController', function ($rootScope,
showConfirmButton: false,
timer: 5000
})
window.location.reload()
$scope.loadfeedsSavedData();
})


Expand Down Expand Up @@ -123,7 +123,9 @@ SocioboardApp.controller('FacebookFeedsManagerController', function ($rootScope,
transformRequest: angular.identity,
}).then(function (response) {
if (response.data == true) {
swal('Post saved successfully');
$scope.loadfeedsSavedData();
$('#ComposePostModal').closeModal();
swal('Post saved successfully');
console.log(response.data);
$(".dropify-clear").click();
}
Expand Down Expand Up @@ -196,26 +198,57 @@ SocioboardApp.controller('FacebookFeedsManagerController', function ($rootScope,

}

$scope.hour_select = function (hrvalue) {
$scope.hourval = hrvalue;
//open schedule modal
$scope.openSchedule = function (feeds) {
debugger;
$('#scheduleModal').openModal();
$scope.selectedFeedsch = feeds;
$rootScope.feedval = feeds;
console.log("noroot", $scope.selectedFeedsch);
console.log("withroot", $rootScope.feedval);
var dateval = $('#datepickerval').val();
var timeval = $scope.hourval + ":" + $scope.minval + '' + $scope.ampmvalu ;
console.log(datetime);
//$http.get(apiDomain + '/api/SavedFeedsManagement/ScheduleMsg?postId=' + selectedFeedData.strId + '&groupId=' + $rootScope.groupId + '&schtime=')
// .then(function (response) {
// $scope.allcomment = response.data;
// }, function (reason) {
// $scope.error = reason.data;
// });

}
$scope.min_select = function (minvalu) {
$scope.minval = minvalu;
}
$scope.ampm_select = function (ampmval) {
$scope.ampmvalu = ampmval;
}

//schedule post
$scope.schdule = function (schdata) {
debugger;
// $('#scheduleModal').openModal();
// $scope.selectedFeedsch = selectedFeedData;
// $rootScope.feedval = selectedFeedData;
var $input = $('.datepicker').pickadate();
var picker = $input.pickadate('picker','dateformat');
var dt = new Date(picker.get());
var hr = $('#hourSelect').val();
var min = $('#minSelect').val();
var ampm = $('#AmPmSelect').val();
var timeval = hr + ':' + min +ampm;
//$('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }).val();

$scope.schedule = function (selectedFeedData) {
$('#scheduleModal').openModal();
$scope.selectedFeed = selectedFeedData;
var datetime = $scope.hourval + ":" + $scope.minval + '' + $scope.ampmvalu

console.log(dt);
var datetime = $scope.hourval + ":" + $scope.minval + '' + $scope.ampmvalu;

$http.get(apiDomain + '/api/SavedFeedsManagement/ScheduleMsg?postId=' + selectedFeedData.strId + '&groupId=' + $rootScope.groupId + '&schtime=')
$http.get(apiDomain + '/api/SavedFeedsManagement/ScheduleMsg?postId=' + schdata.postId + '&groupId=' + $rootScope.groupId + '&schtime=' + picker.get() + '&timeval=' + timeval)
.then(function (response) {
$scope.allcomment = response.data;
if(response.data == true)
{
$('#scheduleModal').closeModal();
swal("successfully scheduled")
$scope.loadfeedsSavedData();
}
else {
swal("error while scheduling")
}
}, function (reason) {
$scope.error = reason.data;
});
Expand Down Expand Up @@ -256,6 +289,7 @@ SocioboardApp.controller('FacebookFeedsManagerController', function ($rootScope,
$http.post(apiDomain + '/api/SavedFeedsManagement/DeletePost?postId=' + tempPostId)
.then(function (response) {
if (response.data == true) {
$scope.loadfeedsSavedData();
swal("Deleted");
}
}, function (reason) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ SocioboardApp.controller('InstagramFeedsController', function ($rootScope, $scop
var lstnofeeds = false;
var preloadmorefeeds = false;
var endfeeds = false;
var ending = start + 10;
var ending = start + 12;
var reachLast = false;
var count = 10;
var videofiltter = false;
// var show = true;
$scope.filterrTxtt = 'All Posts';
$scope.SorttTxtt = 'Popular';
Expand Down Expand Up @@ -78,7 +79,6 @@ SocioboardApp.controller('InstagramFeedsController', function ($rootScope, $scop
}
$http.get(apiDomain + '/api/Instagram/GetInstagramFeeds?instagramId=' + $stateParams.profileId + '&userId=' + $rootScope.user.Id + '&skip=' + ending + '&count=9')
.then(function (response) {
debugger;
// $scope.lstProfiles = response.data;
if (response.data == null || response.data == "") {
$scope.endfeeds = true;
Expand All @@ -100,31 +100,28 @@ SocioboardApp.controller('InstagramFeedsController', function ($rootScope, $scop


$scope.filterSearch = function (postType, txtt) {
//
$scope.nomessages = false;

$scope.filters = true;
$scope.preloadmorefeeds = false;
$scope.lstinsFeeds = null;
$scope.filterrTxtt = txtt;
//codes to load recent Feeds
$http.get(apiDomain + '/api/Instagram/GetInstagramFilterFeeds?instagramId=' + $stateParams.profileId + '&userId=' + $rootScope.user.Id + '&skip=0&count=50' + '&postType=' + postType)
.then(function (response) {
//
debugger;
if (postType == "video")
{
$scope.videofiltter = true;
}
if (response.data == "") {
$scope.nomessages = true;
$scope.preloadmorefeeds = true;
}
// $scope.lstProfiles = response.data;
//$scope.lstinsFeeds = response.data;

if (response.data == null) {
reachLast = true;
}
$scope.lstinsFeeds = response.data;

$scope.preloadmorefeeds = true;

}, function (reason) {
$scope.error = reason.data;
});
Expand Down Expand Up @@ -280,7 +277,6 @@ SocioboardApp.controller('InstagramFeedsController', function ($rootScope, $scop
}

$scope.Deletefeeds = function (id) {
debugger;
var Feedid = id;
$http.get(apiDomain + '/api/Instagram/DeleteinstagramFeed?profileId=' + $stateParams.profileId + '&FeedId=' + Feedid)
.then(function (response) {
Expand Down Expand Up @@ -341,15 +337,13 @@ SocioboardApp.controller('InstagramFeedsController', function ($rootScope, $scop
var qury = $('#categories').val();
$http.get(apiDomain + '/api/Instagram/Searchinsta?instagramId=' + $stateParams.profileId + '&qury=' + qury)
.then(function (response) {
debugger;
if (response != null) {
$scope.seachdata = response.data.data;
debugger;
$('#SearchProfileModal').openModal();
}
else {
swal('No Result Found')
}debugger;
}
var data = response;
});

Expand Down
Loading

0 comments on commit 6997f4b

Please sign in to comment.