Skip to content

Commit

Permalink
Socioboard 3.0
Browse files Browse the repository at this point in the history
Github Commit:
-----------------
-added content studio new features:
-added shareathon features in mostshared
-made changes in content studio ui
-Feeds auto refresh implemented in all modules
-In twitter user can report spam feature implemented
-fix twitter feeds url issue
-upload video issue fix
  • Loading branch information
socioboard committed Aug 21, 2017
1 parent e5599a7 commit be4f025
Show file tree
Hide file tree
Showing 196 changed files with 75,024 additions and 707 deletions.
Binary file modified .vs/Socioboard/v14/.suo
Binary file not shown.
147 changes: 147 additions & 0 deletions src/Api.Socioboard/Controllers/AssestLibraryController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Api.Socioboard.Model;
using Microsoft.AspNetCore.Cors;
using System.Xml;
using System.Text.RegularExpressions;
using Socioboard.Twitter.App.Core;
using MongoDB.Driver;
using Domain.Socioboard.Models;
using Microsoft.AspNetCore.Http;
using System.IO;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Api.Socioboard.Controllers
{
[EnableCors("AllowAll")]
[Route("api/[controller]")]
public class AssestLibraryController : Controller
{
public AssestLibraryController(ILogger<AssestLibraryController> logger, Microsoft.Extensions.Options.IOptions<Helper.AppSettings> settings, IHostingEnvironment env)
{
_logger = logger;
_appSettings = settings.Value;
_redisCache = new Helper.Cache(_appSettings.RedisConfiguration);
_env = env;
}
private readonly ILogger _logger;
private Helper.AppSettings _appSettings;
private Helper.Cache _redisCache;
private readonly IHostingEnvironment _env;

//Ads verfication

[HttpPost("SaveImage")]
public IActionResult SaveImage(long userId,string imgName, IFormFile files)
{

var filename = "";
var apiimgPath = "";
var uploads = string.Empty;
string imgPath = string.Empty;
string imagePath= string.Empty;
if (files != null)
{

if (files.Length > 0)
{
var fileName = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue.Parse(files.ContentDisposition).FileName.Trim('"');
// await file.s(Path.Combine(uploads, fileName));
filename = Microsoft.Net.Http.Headers.ContentDispositionHeaderValue
.Parse(files.ContentDisposition)
.FileName
.Trim('"');
var tempName = Domain.Socioboard.Helpers.SBHelper.RandomString(10) + '.' + fileName.Split('.')[1];
//apiimgPath = _appSettings.ApiDomain + "/api/Media/get?id=" + $@"{tempName}";

filename = _env.WebRootPath + "\\upload\\UserImages" + $@"\{tempName}";
imgPath = filename;
uploads = _appSettings.ApiDomain + "/api/Media/getUserImages?id=" + $@"{tempName}";
// size += file.Length;
try
{
using (FileStream fs = System.IO.File.Create(filename))
{
files.CopyTo(fs);
fs.Flush();
}
filename = uploads;
long length = new System.IO.FileInfo(fileName).Length;
}
catch (System.Exception ex)
{
if (!string.IsNullOrEmpty(imagePath))
{
uploads = imagePath;
}
}

}
}
else
{
}
Domain.Socioboard.Models.AssestLibrary Imglibrary = new AssestLibrary();
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
//long len = (new System.IO.FileInfo(filename)).Length;
Imglibrary.UserId = userId;
Imglibrary.ImageName = imgName;
Imglibrary.ImagePath = filename;
Imglibrary.ImageSize = 25;
Imglibrary.Imageuploadeddate = DateTime.UtcNow;
int SavedStatus = dbr.Add<Domain.Socioboard.Models.AssestLibrary>(Imglibrary);
if(SavedStatus==1)
{
return Ok("Image saved successfully");
}
else
{
return BadRequest("Something went wrong");
}



}

[HttpPost("DeleteImage")]
public IActionResult DeleteImage(long userId, long imgid)
{
try
{
Domain.Socioboard.Models.AssestLibrary Imglibrary = new AssestLibrary();
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
AssestLibrary lstImages = dbr.Single<AssestLibrary>(t => t.UserId == userId && t.Id==imgid);
dbr.Delete<Domain.Socioboard.Models.AssestLibrary>(lstImages);
return Ok("Deleted");
}
catch (Exception ex)
{
return BadRequest("Something went wrong please try after sometime");
}

// return Ok();
}

[HttpGet("LoadImages")]
public IActionResult LoadImages(long userid)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<AssestLibrary> lstImages = dbr.Find<AssestLibrary>(t => t.UserId == userid).ToList();
if (lstImages != null)
{
return Ok(lstImages);
}
else
{
return NotFound();
}

}
}
}
116 changes: 116 additions & 0 deletions src/Api.Socioboard/Controllers/ContentStudioController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
using Domain.Socioboard.Interfaces.Services;
using Microsoft.AspNetCore.Hosting;
using Api.Socioboard.Model;
using MongoDB.Driver;
using Newtonsoft.Json;
using System.Net.Http;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

Expand Down Expand Up @@ -38,5 +41,118 @@ public IActionResult GetAdvanceSearchData(string keywords)
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
return Ok(Repositories.ContentStudioRepository.GetAdvanceSearchdata(keywords, _redisCache, _appSettings));
}


//[HttpPost("saveDataIdForShare")]
//public IActionResult saveDataIdForShare(HttpRequestMessage shareData, [FromBody] Domain.Socioboard.Models.Mongo.ContentFeedsShareathon getAll)//List<Domain.Socioboard.Models.Mongo.ContentFeedsShareathon> shareData
//{
// Object FacebookPageId = Request.Form["shareData"];
// string s = JsonConvert.SerializeObject(FacebookPageId);
// DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
// //string res = Repositories.ContentStudioRepository.saveContentDataIdReposi(shareData, fbuserIds, timeIntervals, _redisCache, _appSettings);
// return Ok(true);
//}

//[HttpPost("saveDataIdForShare")]
//public IActionResult saveDataIdForShare(Domain.Socioboard.Models.Mongo.postdata objdata)
//{

// //string s = JsonConvert.SerializeObject(FacebookPageId);
// DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
// //string res = Repositories.ContentStudioRepository.saveContentDataIdReposi(shareData, fbuserIds, timeIntervals, _redisCache, _appSettings);
// return Ok(true);
//}






[HttpPost("saveDataIdForShare")]
public IActionResult saveDataIdForShare(string fbuserIds, int timeIntervals)
{
//List<Domain.Socioboard.Models.Mongo.ContentFeedsShareathon> shareData
var FacebookPageId = Request.Form["shareData"];
List<Domain.Socioboard.Models.Mongo.ContentFeedsShareathon> lstshareData = JsonConvert.DeserializeObject<List<Domain.Socioboard.Models.Mongo.ContentFeedsShareathon>>(FacebookPageId);
var fbuserIds1 = Request.Form["FacebookPageId"];
//string s = JsonConvert.SerializeObject(FacebookPageId);
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
//string res = Repositories.ContentStudioRepository.saveContentDataIdReposi(shareData, fbuserIds, timeIntervals, _redisCache, _appSettings);
return Ok(true);
}


[HttpGet("GetYTAdvanceSearchData")]
public IActionResult GetYTAdvanceSearchData(Domain.Socioboard.Enum.NetworkType network, int skip, int count)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
MongoRepository mongorepo = new MongoRepository("AdvanceSerachData", _appSettings);
if (skip + count < 100)
{
return Ok(Repositories.ContentStudioRepository.YuTubeAdvanceSerachData(network, _redisCache, _appSettings).Skip(skip).Take(count));
}
else
{
var builder = Builders<Domain.Socioboard.Models.Mongo.AdvanceSerachData>.Sort;
var sort = builder.Descending(t => t.totalShareCount);
var result = mongorepo.FindWithRange<Domain.Socioboard.Models.Mongo.AdvanceSerachData>(t => t.networkType.Equals(network), sort, skip, count);
var task = Task.Run(async () =>
{
return await result;
});
IList<Domain.Socioboard.Models.Mongo.AdvanceSerachData> lstTwitterFeeds = task.Result;
return Ok(lstTwitterFeeds);
}
}


[HttpGet("GetSortByData")]
public IActionResult GetSortByData(string sortType, int skip, int count)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
MongoRepository mongorepo = new MongoRepository("AdvanceSerachData", _appSettings);
if (skip + count < 200)
{
return Ok(Repositories.ContentStudioRepository.GetSortBy(sortType, _redisCache, _appSettings).Skip(skip).Take(count));
}
else
{
var builder = Builders<Domain.Socioboard.Models.Mongo.AdvanceSerachData>.Sort;
var sort = builder.Descending(t => t.totalShareCount);
var result = mongorepo.FindWithRange<Domain.Socioboard.Models.Mongo.AdvanceSerachData>(t => t.twtShareCount != 0, sort, skip, count);
var task = Task.Run(async () =>
{
return await result;
});
IList<Domain.Socioboard.Models.Mongo.AdvanceSerachData> lstTwitterFeeds = task.Result;
return Ok(lstTwitterFeeds);
}
}


[HttpGet("QuickTopics")]
public IActionResult QuickTopics(Domain.Socioboard.Enum.NetworkType networkType, int skip, int count)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
MongoRepository mongorepo = new MongoRepository("AdvanceSerachData", _appSettings);
if (skip + count < 100)
{
return Ok(Repositories.ContentStudioRepository.QuickTopicRepository(networkType, _redisCache, _appSettings).Skip(skip).Take(count));
}
else
{
var builder = Builders<Domain.Socioboard.Models.Mongo.AdvanceSerachData>.Sort;
var sort = builder.Descending(t => t.totalShareCount);
var result = mongorepo.FindWithRange<Domain.Socioboard.Models.Mongo.AdvanceSerachData>(t => t.twtShareCount != 0, sort, skip, count);
var task = Task.Run(async () =>
{
return await result;
});
IList<Domain.Socioboard.Models.Mongo.AdvanceSerachData> lstTwitterFeeds = task.Result;
return Ok(lstTwitterFeeds);
}
}


}
}
Loading

0 comments on commit be4f025

Please sign in to comment.