Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
246b450
Created Role Test and Given User Role Whenever anyone logs in
codingdefined Jul 25, 2018
e71286d
Added Angular JS to the Project under LetsDisc.Web.Host
codingdefined Oct 17, 2018
71e0f50
Merge branch 'development' of https://github.com/codingdefined/LetsDi…
codingdefined Oct 17, 2018
3dd15f9
Added child components and fixed the initial load issue
codingdefined May 28, 2019
c42004e
Merge pull request #4 from codingdefined/master
codingdefined May 28, 2019
237ef81
Added PostType Class and Added Initial Seed Data
codingdefined May 28, 2019
460b637
Updated ReadMe and Changed Migrations File
codingdefined May 28, 2019
4a43158
Merge branch 'development' of https://github.com/codingdefined/LetsDi…
codingdefined May 28, 2019
0cc8d13
Changing the Database Structure, Questions and Answers will be saved …
codingdefined May 29, 2019
b24ce4d
Creating Post Service and Frontend
codingdefined May 30, 2019
c88ef53
Completed Creating Post, Post Detail, Upvote and Downvote Post
codingdefined Jun 10, 2019
9b081c0
Added Voting on Answers
codingdefined Jun 12, 2019
583995d
Added a way to edit the question
codingdefined Jun 12, 2019
75c6915
Some refactoring and added posts-tag route
codingdefined Jun 13, 2019
ea7cfdc
Added Page Not Found and Removed Permission Issue in Users route
codingdefined Jun 13, 2019
8bc034b
Draft of External Login with Github and Google
codingdefined Jun 20, 2019
a8ee073
Added few more concepts for Logging In
codingdefined Jun 20, 2019
c840a1f
Changing the way External Login Works
codingdefined Jun 21, 2019
e1eb2bc
Added Angular Social Login Component for Google Login
codingdefined Jun 25, 2019
ae8cba4
Added Validation for both Create Question and Edit question
codingdefined Jun 26, 2019
02eaf6e
Added JWT Authentication in Server Side
codingdefined Jun 26, 2019
ec5d420
Added UserDetails Class and added Route Guard for asking questions.
codingdefined Jul 2, 2019
d902c90
1. Added User Details and Edit User, 2. Changed the Top Bar Component…
codingdefined Jul 12, 2019
2f6c878
1. Updating User Editing, 2. Filter questions based on tags
codingdefined Jul 15, 2019
cac5573
[Security] Bump extend from 3.0.1 to 3.0.2 in /src/LetsDisc.Web.Host
dependabot-preview[bot] Jul 15, 2019
b844f3d
[Security] Bump bootstrap from 3.3.7 to 4.1.2 in /src/LetsDisc.Web.Host
dependabot-preview[bot] Jul 15, 2019
addf00c
Merge pull request #7 from codingdefined/dependabot/npm_and_yarn/src/…
codingdefined Jul 15, 2019
e94db10
Merge branch 'development' into dependabot/npm_and_yarn/src/LetsDisc.…
codingdefined Jul 15, 2019
2fc317b
Merge pull request #8 from codingdefined/dependabot/npm_and_yarn/src/…
codingdefined Jul 15, 2019
dab506c
Updated package and improving CSS
codingdefined Jul 16, 2019
ab7af63
Profile Image Upload
codingdefined Jul 18, 2019
3ad8099
Edit functionality enabled for logged in user.
codingdefined Jul 19, 2019
487a1e7
Added Sorting in Posts Tab
codingdefined Jul 24, 2019
be52d49
Added Questions and Answers below User Profile
codingdefined Jul 25, 2019
c2f0267
1. Added Title and Meta for SEO
codingdefined Aug 6, 2019
e3a943e
1. Fixed issue with Sorting
codingdefined Aug 7, 2019
2ab3a35
Changed to Quill.js for better editor support
codingdefined Aug 9, 2019
775a590
1. Removed MVC Project
codingdefined Aug 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,4 @@ paket-files/
/src/LetsDisc.Web.Mvc/App_Data/Logs/Logs.txt
/src/LetsDisc.EntityFrameworkCore/Migrations/20180628102141_LetsDisc-v1.cs
/src/LetsDisc.EntityFrameworkCore/Migrations/20180628102141_LetsDisc-v1.Designer.cs
**/appsettings.json
12 changes: 4 additions & 8 deletions LetsDisc.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LetsDisc.Web.Host", "src\Le
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LetsDisc.Web.Core", "src\LetsDisc.Web.Core\LetsDisc.Web.Core.csproj", "{22CFE0D2-8DCA-42D7-AD7D-784C3862493F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LetsDisc.Web.Mvc", "src\LetsDisc.Web.Mvc\LetsDisc.Web.Mvc.csproj", "{A2213374-BB48-48FD-BBD4-81E6A961D866}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LetsDisc.EntityFrameworkCore", "src\LetsDisc.EntityFrameworkCore\LetsDisc.EntityFrameworkCore.csproj", "{E0580562-F8F2-4EBB-B07A-ABFC6F2C314F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LetsDisc.EntityFrameworkCore", "src\LetsDisc.EntityFrameworkCore\LetsDisc.EntityFrameworkCore.csproj", "{E0580562-F8F2-4EBB-B07A-ABFC6F2C314F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -53,10 +51,6 @@ Global
{22CFE0D2-8DCA-42D7-AD7D-784C3862493F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22CFE0D2-8DCA-42D7-AD7D-784C3862493F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22CFE0D2-8DCA-42D7-AD7D-784C3862493F}.Release|Any CPU.Build.0 = Release|Any CPU
{A2213374-BB48-48FD-BBD4-81E6A961D866}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2213374-BB48-48FD-BBD4-81E6A961D866}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2213374-BB48-48FD-BBD4-81E6A961D866}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2213374-BB48-48FD-BBD4-81E6A961D866}.Release|Any CPU.Build.0 = Release|Any CPU
{E0580562-F8F2-4EBB-B07A-ABFC6F2C314F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0580562-F8F2-4EBB-B07A-ABFC6F2C314F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0580562-F8F2-4EBB-B07A-ABFC6F2C314F}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -72,7 +66,9 @@ Global
{880B3591-E057-46FE-B525-10BD83828B93} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{38E184BD-E874-4633-A947-AED4FDB73F40} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{22CFE0D2-8DCA-42D7-AD7D-784C3862493F} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{A2213374-BB48-48FD-BBD4-81E6A961D866} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{E0580562-F8F2-4EBB-B07A-ABFC6F2C314F} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B3A2FADE-BA3D-4AAF-BF24-5F5830504141}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ You should have Visual Studio 2017 Installed on your system.
git clone https://github.com/codingdefined/LetsDisc LetsDisc

Open LetsDisc Folder and run LetsDisc.sln.
Run the Solution to get the API information : http://localhost:21021/swagger/index.html
In Node Terminal (LetsDisc/src/LetsDisc.Web.Host), run npm install and then npm start to run the Angular App

When adding a new class (Make Sure the Default Project is src/LetsDisc.EntityFrameworkCore)

1. First delete the database
2. Run `Remove-Migration` from Package Manager Console
3. Run `Add-Migration LetsDisc-v1` to add the latest migration
4. Run `update-database` to update the database

### Technology Stack

Expand Down
57 changes: 57 additions & 0 deletions build/build-with-ng.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# COMMON PATHS

$buildFolder = (Get-Item -Path "./" -Verbose).FullName
$slnFolder = Join-Path $buildFolder "../"
$outputFolder = Join-Path $buildFolder "outputs"
$webHostFolder = Join-Path $slnFolder "src/LetsDisc.Web.Host"
$ngFolder = Join-Path $buildFolder "../../angular"

## CLEAR ######################################################################

Remove-Item $outputFolder -Force -Recurse -ErrorAction Ignore
New-Item -Path $outputFolder -ItemType Directory

## RESTORE NUGET PACKAGES #####################################################

Set-Location $slnFolder
dotnet restore

## PUBLISH WEB HOST PROJECT ###################################################

Set-Location $webHostFolder
dotnet publish --output (Join-Path $outputFolder "Host")

## PUBLISH ANGULAR UI PROJECT #################################################

Set-Location $ngFolder
& yarn
& ng build -prod
Copy-Item (Join-Path $ngFolder "dist") (Join-Path $outputFolder "ng") -Recurse
Copy-Item (Join-Path $ngFolder "Dockerfile") (Join-Path $outputFolder "ng")

# Change UI configuration
$ngConfigPath = Join-Path $outputFolder "ng/assets/appconfig.json"
(Get-Content $ngConfigPath) -replace "21021", "9901" | Set-Content $ngConfigPath
(Get-Content $ngConfigPath) -replace "4200", "9902" | Set-Content $ngConfigPath

## CREATE DOCKER IMAGES #######################################################

# Host
Set-Location (Join-Path $outputFolder "Host")

docker rmi abp/host -f
docker build -t abp/host .

# Angular UI
Set-Location (Join-Path $outputFolder "ng")

docker rmi abp/ng -f
docker build -t abp/ng .

## DOCKER COMPOSE FILES #######################################################

Copy-Item (Join-Path $slnFolder "docker/ng/*.*") $outputFolder

## FINALIZE ###################################################################

Set-Location $outputFolder
17 changes: 17 additions & 0 deletions docker/ng/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '2'

services:

abp_host:
image: abp/host
environment:
- ASPNETCORE_ENVIRONMENT=Staging
ports:
- "9901:80"
volumes:
- "./Host-Logs:/app/App_Data/Logs"

abp_ng:
image: abp/ng
ports:
- "9902:80"
1 change: 1 addition & 0 deletions docker/ng/down.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker-compose down -v --rmi local
1 change: 1 addition & 0 deletions docker/ng/up.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker-compose up -d
7 changes: 6 additions & 1 deletion src/LetsDisc.Application/LetsDisc.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>1.0.0.0</VersionPrefix>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>LetsDisc.Application</AssemblyName>
<PackageId>LetsDisc.Application</PackageId>
Expand All @@ -16,4 +16,9 @@
<ItemGroup>
<ProjectReference Include="..\LetsDisc.Core\LetsDisc.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc.Core">
<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.core\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
17 changes: 15 additions & 2 deletions src/LetsDisc.Application/LetsDiscAppServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Abp.Runtime.Session;
using LetsDisc.Authorization.Users;
using LetsDisc.MultiTenancy;
using Microsoft.AspNetCore.Http;
using System.Security.Claims;

namespace LetsDisc
{
Expand All @@ -23,9 +25,20 @@ protected LetsDiscAppServiceBase()
LocalizationSourceName = LetsDiscConsts.LocalizationSourceName;
}

protected virtual Task<User> GetCurrentUserAsync()
protected async virtual Task<User> GetCurrentUserAsync()
{
var user = UserManager.FindByIdAsync(AbpSession.GetUserId().ToString());
var user = await UserManager.FindByIdAsync(AbpSession.GetUserId().ToString());
if (user == null)
{
throw new Exception("There is no current user!");
}

return user;
}

protected async virtual Task<User> GetUserByEmailAsync(string email)
{
var user = await UserManager.FindByEmailAsync(email);
if (user == null)
{
throw new Exception("There is no current user!");
Expand Down
8 changes: 8 additions & 0 deletions src/LetsDisc.Application/Posts/Dto/AnswerWithQuestion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace LetsDisc.Posts.Dto
{
public class AnswerWithQuestion
{
public PostDto Question { get; set; }
public PostDto Answer { get; set; }
}
}
24 changes: 24 additions & 0 deletions src/LetsDisc.Application/Posts/Dto/CreatePostDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Abp.AutoMapper;
using LetsDisc.PostDetails;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace LetsDisc.Posts.Dto
{
[AutoMapTo(typeof(Post))]
public class CreatePostDto
{
[Required]
public string Title { get; set; }
[Required]
public string Body { get; set; }
[Required]
public int PostTypeId { get; set; }

public int ParentId { get; set; }

public string Tags { get; set; }
}
}
28 changes: 28 additions & 0 deletions src/LetsDisc.Application/Posts/Dto/PostDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Domain.Entities.Auditing;
using LetsDisc.PostDetails;
using System;
using System.Collections.Generic;
using System.Text;

namespace LetsDisc.Posts.Dto
{
[AutoMap(typeof(Post))]
public class PostDto : FullAuditedEntityDto
{
public string Title { get; set; }
public string Body { get; set; }
public int PostTypeId { get; set; }
public int AcceptedAnswerId { get; set; }
public int ParentId { get; set; }
public int Score { get; set; }
public int ViewCount { get; set; }
public DateTime LastActivityDate { get; set; }
public string Tags { get; set; }
public int AnswerCount { get; set; }
public int CommentCount { get; set; }
public int FavoriteCount { get; set; }
public string CreatorUserName { get; set; }
}
}
12 changes: 12 additions & 0 deletions src/LetsDisc.Application/Posts/Dto/PostWithAnswers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace LetsDisc.Posts.Dto
{
public class PostWithAnswers
{
public PostWithVoteInfo Post { get; set; }
public List<PostWithVoteInfo> Answers { get; set; }
}
}
16 changes: 16 additions & 0 deletions src/LetsDisc.Application/Posts/Dto/PostWithVoteInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Abp.AutoMapper;
using LetsDisc.PostDetails;
using LetsDisc.Votes;
using System;
using System.Collections.Generic;
using System.Text;

namespace LetsDisc.Posts.Dto
{
public class PostWithVoteInfo
{
public PostDto Post { get; set; }
public bool Upvote { get; set; }
public bool Downvote { get; set; }
}
}
19 changes: 19 additions & 0 deletions src/LetsDisc.Application/Posts/Dto/SubmitAnswerInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace LetsDisc.Posts.Dto
{
public class SubmitAnswerInput
{
[Range(1, int.MaxValue)]
public int QuestionId { get; set; }

[Required]
public string Body { get; set; }

[Required]
public string Title { get; set; }
}
}
19 changes: 19 additions & 0 deletions src/LetsDisc.Application/Posts/Dto/VoteChangeOutput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace LetsDisc.Posts.Dto
{
public class VoteChangeOutput
{
public int VoteCount { get; set; }
public bool UpVote { get; set; }
public bool DownVote { get; set; }
public int PostTypeId { get; set; }
public int PostId { get; set; }

public VoteChangeOutput()
{
}
}
}
21 changes: 21 additions & 0 deletions src/LetsDisc.Application/Posts/IPostAppService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using LetsDisc.Posts.Dto;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace LetsDisc.Posts
{
public interface IPostAppService : IAsyncCrudAppService<PostDto, int, PagedAndSortedResultRequestDto, CreatePostDto, PostDto>
{
Task<PagedResultDto<PostDto>> GetQuestions(PagedAndSortedResultRequestDto input, string tag);
Task<PostWithAnswers> GetPost(int id);
Task<VoteChangeOutput> PostVoteUp(int id);
Task<VoteChangeOutput> PostVoteDown(int id);
Task<PostWithVoteInfo> SubmitAnswer(SubmitAnswerInput input);
Task<PostWithAnswers> UpdateQuestion(PostDto input);
}
}
Loading