Skip to content

pmishra branch #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/TaskTracker.Common/Class1.cs

This file was deleted.

11 changes: 11 additions & 0 deletions src/TaskTracker.Common/DataStrategy/ICacheStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace TaskTracker.Common.DataStrategy
{
public interface ICacheStrategy<T> where T : class
{
bool InsertOrUpdate(T entity);
T Get(string id);
bool Invalidate(string id);
}
}
10 changes: 10 additions & 0 deletions src/TaskTracker.Common/DataStrategy/IDbStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using TaskTracker.Common.Repository;

namespace TaskTracker.Common.DataStrategy
{
public interface IDbStrategy<T> : IRepository<T> where T : class
{

}
}
10 changes: 10 additions & 0 deletions src/TaskTracker.Common/DataStrategy/IInMemoryDbStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using TaskTracker.Common.Repository;

namespace TaskTracker.Common.DataStrategy
{
public interface IInMemoryDbStrategy<T> : IDbStrategy<T> where T : class
{

}
}
10 changes: 10 additions & 0 deletions src/TaskTracker.Common/DataStrategy/INoSqlDbStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using TaskTracker.Common.Repository;

namespace TaskTracker.Common.DataStrategy
{
public interface INoSqlDbStrategy<T> : IDbStrategy<T> where T : class
{

}
}
9 changes: 9 additions & 0 deletions src/TaskTracker.Common/DataStrategy/ISqlDbStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace TaskTracker.Common.DataStrategy
{
public interface ISqlDbStrategy<T> : IDbStrategy<T> where T : class
{

}
}
22 changes: 22 additions & 0 deletions src/TaskTracker.Common/Models/FeatureModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace TaskTracker.Common.Models
{
public class FeatureModel
{
public string FeatureName { get; set; }
public string FeatureDescription { get; set; }
[Key]
public Guid FeatureID { get; set; }
public Guid ProjectID { get; set; }
public Guid SprintID { get; set; }
//public string[] Tags { get; set; }
public int RankID { get; set; }
public Guid FeatureOwnerID { get; set; }
public DateTime CreatedDate { get; set; }
public Guid CreatedBy { get; set; }
public DateTime LastModifiedDate { get; set; }
public string LastModifiedBy { get; set; }
}
}
17 changes: 17 additions & 0 deletions src/TaskTracker.Common/Models/ProjectModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace TaskTracker.Common.Models
{
public class ProjectModel
{
[Key]
public Guid ProjectID { get; set; }
public string ProjectName { get; set; }
public string ProjectDescription { get; set; }
public DateTime CreatedDate { get; set; }
public Guid CreatedBy { get; set; }
public DateTime LastModifiedDate { get; set; }
public Guid LastModifiedBy { get; set; }
}
}
17 changes: 17 additions & 0 deletions src/TaskTracker.Common/Models/SprintModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace TaskTracker.Common.Models
{
public class SprintModel
{
[Key]
public Guid SprintID { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public DateTime CreatedDate { get; set; }
public Guid CreatedBy { get; set; }
public DateTime LastModifiedDate { get; set; }
public Guid LastModifiedBy { get; set; }
}
}
22 changes: 22 additions & 0 deletions src/TaskTracker.Common/Models/TaskModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace TaskTracker.Common.Models
{
public class TaskModel
{
public string TaskName { get; set; }
public string TaskDescription { get; set; }
[Key]
public Guid TaskID { get; set; }
public Guid TaskOwnerID { get; set; }
public Guid SprintID { get; set; }
public Guid FeatureID { get; set; }
public Guid ProjectID { get; set; }
public DateTime CreatedDate { get; set; }
public Guid CreatedBy { get; set; }
public DateTime LastModifiedDate { get; set; }
public Guid LastModifiedBy { get; set; }
public string CurrentStatus { get; set; }
}
}
23 changes: 23 additions & 0 deletions src/TaskTracker.Common/Models/UserModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace TaskTracker.Common.Models
{
public class UserModel
{
[Key]
public Guid UserID { get; set; }

public string Username { get; set; }

public string Password { get; set; }

public UserType Usertype { get; set; }
}

public enum UserType
{
Admin,
TeamMember
}
}
13 changes: 13 additions & 0 deletions src/TaskTracker.Common/Repository/IRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;

namespace TaskTracker.Common.Repository
{
public interface IRepository<T> where T : class
{
IEnumerable<T> GetAll();
T Delete(string id);
T GetById(string id);
T InsertOrUpdate(T entity);
}
}
39 changes: 39 additions & 0 deletions src/TaskTracker.Common/Repository/Repository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using TaskTracker.Common.DataStrategy;

namespace TaskTracker.Common.Repository
{
public abstract class Repository<T> : IRepository<T> where T : class
{
protected ICacheStrategy<T> cacheStrategy;

protected IDbStrategy<T> dbStrategy;

public Repository(ICacheStrategy<T> cacheStrategy, IDbStrategy<T> dbStrategy)
{
this.cacheStrategy = cacheStrategy;
this.dbStrategy = dbStrategy;
}

public T GetById(string id)
{
var item = this.cacheStrategy.Get(id);
if (item != null)
{
return item;
}

item = this.dbStrategy.GetById(id);
this.cacheStrategy.InsertOrUpdate(item);

return item;
}

public abstract IEnumerable<T> GetAll();

public abstract T Delete(string id);

public abstract T InsertOrUpdate(T entity);
}
}
1 change: 1 addition & 0 deletions src/TaskTracker.Common/TaskTracker.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
<PackageReference Include="RawRabbit.DependencyInjection.ServiceCollection" Version="2.0.0-beta8" />
<PackageReference Include="RawRabbit.Operations.Publish" Version="2.0.0-beta8" />
<PackageReference Include="RawRabbit.Operations.Subscribe" Version="2.0.0-beta8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.2" />
</ItemGroup>
</Project>
21 changes: 21 additions & 0 deletions src/TaskTracker.Services.Tasks/DataStrategy/CacheStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using TaskTracker.Common.DataStrategy;

namespace TaskTracker.Services.Tasks.DataStrategy
{
public class CacheStrategy<T> : ICacheStrategy<T> where T : class
{
public bool InsertOrUpdate(T entity)
{
throw new NotImplementedException();
}
public T Get(string id)
{
throw new NotImplementedException();
}
public bool Invalidate(string id)
{
throw new NotImplementedException();
}
}
}
28 changes: 28 additions & 0 deletions src/TaskTracker.Services.Tasks/DataStrategy/InMemoryDbStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using TaskTracker.Common.DataStrategy;
using TaskTracker.Services.Tasks.EF;
using Microsoft.AspNetCore.Builder;

namespace TaskTracker.Services.Tasks.DataStrategy
{
public class InMemoryDbStrategy<T> : IInMemoryDbStrategy<T> where T : class
{
public IEnumerable<T> GetAll()
{
throw new NotImplementedException();
}
public T Delete(string id)
{
throw new NotImplementedException();
}
public T GetById(string id)
{
throw new NotImplementedException();
}
public T InsertOrUpdate(T entity)
{
throw new NotImplementedException();
}
}
}
26 changes: 26 additions & 0 deletions src/TaskTracker.Services.Tasks/DataStrategy/NoSqlDbStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using TaskTracker.Common.DataStrategy;

namespace TaskTracker.Services.Tasks.DataStrategy
{
public class NoSqlDbStrategy<T> : INoSqlDbStrategy<T> where T : class
{
public IEnumerable<T> GetAll()
{
throw new NotImplementedException();
}
public T Delete(string id)
{
throw new NotImplementedException();
}
public T GetById(string id)
{
throw new NotImplementedException();
}
public T InsertOrUpdate(T entity)
{
throw new NotImplementedException();
}
}
}
26 changes: 26 additions & 0 deletions src/TaskTracker.Services.Tasks/DataStrategy/SqlDbStrategy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using TaskTracker.Common.DataStrategy;

namespace TaskTracker.Services.Tasks.DataStrategy
{
public class SqlDbStrategy<T> : ISqlDbStrategy<T> where T : class
{
public IEnumerable<T> GetAll()
{
throw new NotImplementedException();
}
public T Delete(string id)
{
throw new NotImplementedException();
}
public T GetById(string id)
{
throw new NotImplementedException();
}
public T InsertOrUpdate(T entity)
{
throw new NotImplementedException();
}
}
}
30 changes: 30 additions & 0 deletions src/TaskTracker.Services.Tasks/EF/DataContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore;
using TaskTracker.Common.Models;

namespace TaskTracker.Services.Tasks.EF
{
public class DataContext : DbContext
{
// public DataContext(DbContextOptions<DataContext> options) : base(options)
// {

// }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseInMemoryDatabase("inmemorydb");
//optionsBuilder.UseSqlite("Data Source=sql.db");
}

public DbSet<TaskModel> tasks { get; set; }

public DbSet<FeatureModel> features { get; set; }

public DbSet<ProjectModel> projects { get; set; }

public DbSet<SprintModel> sprints { get; set; }

public DbSet<UserModel> users { get; set; }
}
}
Loading