-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vladimir Damov
committed
Sep 8, 2021
1 parent
1cd8641
commit eeb1fd5
Showing
57 changed files
with
19,170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk"> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectVersion>2.1</ProjectVersion> | ||
<DockerTargetOS>Linux</DockerTargetOS> | ||
<ProjectGuid>c46f0724-376b-45ff-b8af-5a36443261da</ProjectGuid> | ||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction> | ||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl> | ||
<DockerServiceName>api</DockerServiceName> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Include="docker-compose.override.yml"> | ||
<DependentUpon>docker-compose.yml</DependentUpon> | ||
</None> | ||
<None Include="docker-compose.yml" /> | ||
<None Include=".dockerignore" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.4' | ||
|
||
services: | ||
api: | ||
environment: | ||
- ASPNETCORE_ENVIRONMENT=Development | ||
- ASPNETCORE_URLS=https://+:443;http://+:80 | ||
ports: | ||
- "80" | ||
- "443" | ||
volumes: | ||
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro | ||
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: '3.4' | ||
|
||
services: | ||
mssql_db: | ||
image: ${DOCKER_REGISTRY-}mcr.microsoft.com/mssql/server | ||
restart: always | ||
environment: | ||
SA_PASSWORD: "P@ssw0rd" | ||
ACCEPT_EULA: "Y" | ||
ports: | ||
- "1433:1433" | ||
|
||
api: | ||
image: ${DOCKER_REGISTRY-}mcr.microsoft.com/dotnet/aspnet | ||
environment: | ||
- CHOKIDAR_USEPOLLING=true | ||
build: | ||
context: . | ||
dockerfile: mIRC.Web/Dockerfile | ||
volumes: | ||
- .:/app | ||
depends_on: | ||
- mssql_db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using mIRC.Core.Interfaces; | ||
using System; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace mIRC.Core.Entities | ||
{ | ||
public class BaseModel<TKey> : IAuditInfo | ||
{ | ||
[Key] | ||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] | ||
public TKey Id { get; set; } | ||
public DateTime CreatedOn { get; set; } | ||
public DateTime? ModifiedOn { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace mIRC.Core.Enums | ||
{ | ||
public enum RoomType | ||
{ | ||
Public = 0, | ||
Private | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace mIRC.Core.Interfaces | ||
{ | ||
public interface IAuditInfo | ||
{ | ||
DateTime CreatedOn { get; set; } | ||
|
||
DateTime? ModifiedOn { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Design; | ||
using Microsoft.Extensions.Configuration; | ||
using System; | ||
using System.IO; | ||
|
||
namespace mIRC.Db | ||
{ | ||
public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<mIRCDbContext> | ||
{ | ||
|
||
public mIRCDbContext CreateDbContext(string[] args) | ||
{ | ||
string environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); | ||
|
||
IConfigurationRoot configuration = new ConfigurationBuilder() | ||
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../mIRC.Web")) | ||
.AddJsonFile($"appsettings{environment}.json").Build(); | ||
|
||
var builder = new DbContextOptionsBuilder<mIRCDbContext>(); | ||
var connectionString = configuration.GetConnectionString("DefaultConnection"); | ||
|
||
builder.UseSqlServer(connectionString); | ||
|
||
return new mIRCDbContext(builder.Options); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using mIRC.Core.Entities; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace mIRC.Db.Entities | ||
{ | ||
public class Message : BaseModel<string> | ||
{ | ||
[Required(AllowEmptyStrings = false)] | ||
[MaxLength(500)] | ||
public string Text { get; set; } | ||
|
||
public string UserId { get; set; } | ||
public User User { get; set; } | ||
public string RoomId { get; set; } | ||
public Room Room { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using mIRC.Core.Entities; | ||
using mIRC.Core.Enums; | ||
using System.Collections.Generic; | ||
|
||
namespace mIRC.Db.Entities | ||
{ | ||
public class Room : BaseModel<string> | ||
{ | ||
public string Name { get; set; } | ||
public RoomType Type { get; set; } | ||
public ICollection<User> Users { get; set; } = new HashSet<User>(); | ||
public ICollection<Message> Messages { get; set; } = new HashSet<Message>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.AspNetCore.Identity; | ||
using mIRC.Core.Interfaces; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace mIRC.Db.Entities | ||
{ | ||
public class User : IdentityUser, IAuditInfo | ||
{ | ||
public DateTime CreatedOn { get; set; } | ||
public DateTime? ModifiedOn { get; set; } | ||
|
||
public ICollection<Room> Rooms { get; set; } = new HashSet<Room>(); | ||
|
||
} | ||
} |
Oops, something went wrong.