mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-12 11:46:40 +00:00
project/id/addmembers endpoint
This commit is contained in:
parent
2f03b8f402
commit
54c221236b
7 changed files with 75 additions and 13 deletions
|
|
@ -111,7 +111,45 @@ namespace TicketManager.Controllers
|
||||||
|
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
[HttpPost("{id}/addMembers")]
|
||||||
|
public async Task<ActionResult<Project>> AddMembersToProject(int id, List<User> usersToAdd)
|
||||||
|
{
|
||||||
|
var project = await _context.Projects
|
||||||
|
.Include(p => p.Assignments)
|
||||||
|
.FirstOrDefaultAsync(p => p.Id == id);
|
||||||
|
|
||||||
|
project.AddMembers(usersToAdd);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost("{id}/removeMembers")]
|
||||||
|
public async Task<ActionResult<Project>> RemoveMembersToProject(int id, List<User> usersToRemove)
|
||||||
|
{
|
||||||
|
var project = await _context.Projects
|
||||||
|
.Include(p => p.Assignments)
|
||||||
|
.FirstOrDefaultAsync(p => p.Id == id);
|
||||||
|
|
||||||
|
project.RemoveMembers(usersToRemove);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("{id}/setMembers")]
|
||||||
|
public async Task<ActionResult<Project>> SetProjectMembers(int id, List<User> projectMembers)
|
||||||
|
{
|
||||||
|
var project = await _context.Projects
|
||||||
|
.Include(p => p.Assignments)
|
||||||
|
.FirstOrDefaultAsync(p => p.Id == id);
|
||||||
|
|
||||||
|
project.SetMembers(projectMembers);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
return project;
|
||||||
|
}
|
||||||
private bool ProjectExists(int id)
|
private bool ProjectExists(int id)
|
||||||
{
|
{
|
||||||
return _context.Projects.Any(e => e.Id == id);
|
return _context.Projects.Any(e => e.Id == id);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace TicketManager.Models
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public DateTime UpdateDate { get; } = DateTime.Now;
|
public DateTime UpdateDate { get; set; } = DateTime.Now;
|
||||||
public ActivityType ActivityType { get; set; } = ActivityType.Undefined;
|
public ActivityType ActivityType { get; set; } = ActivityType.Undefined;
|
||||||
|
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace TicketManager.Models
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public DateTime Created_at { get; } = DateTime.Now;
|
public DateTime Created_at { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
public Ticket Ticket { get; set; }
|
public Ticket Ticket { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace TicketManager.Models
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public DateTime CreatedAt { get; } = DateTime.Now;
|
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||||
public DateTime PlannedEnding { get; set; }
|
public DateTime PlannedEnding { get; set; }
|
||||||
public float Progression
|
public float Progression
|
||||||
{
|
{
|
||||||
|
|
@ -40,13 +40,13 @@ namespace TicketManager.Models
|
||||||
{ return _tickets ?? new List<Ticket>(); }
|
{ return _tickets ?? new List<Ticket>(); }
|
||||||
set { _tickets = value; }
|
set { _tickets = value; }
|
||||||
}
|
}
|
||||||
// private List<History> _edits;
|
private List<History> _edits;
|
||||||
// public List<History> Edits
|
public List<History> Edits
|
||||||
// {
|
{
|
||||||
// get
|
get
|
||||||
// { return _edits ?? new List<History>(); }
|
{ return _edits ?? new List<History>(); }
|
||||||
// set { _edits = value; }
|
set { _edits = value; }
|
||||||
// }
|
}
|
||||||
private List<File> _files;
|
private List<File> _files;
|
||||||
public List<File> Files
|
public List<File> Files
|
||||||
{
|
{
|
||||||
|
|
@ -78,6 +78,9 @@ namespace TicketManager.Models
|
||||||
{
|
{
|
||||||
this.Assignments.RemoveAll(a => membersToRemove.Contains(a.User));
|
this.Assignments.RemoveAll(a => membersToRemove.Contains(a.User));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetMembers(List<User> projectMembers)
|
||||||
|
{ throw new NotImplementedException("Not Implemented"); }
|
||||||
public int GetMembersCount() => this.GetMembers().Count();
|
public int GetMembersCount() => this.GetMembers().Count();
|
||||||
public void GetTicketsCount() => this.Tickets.Count();
|
public void GetTicketsCount() => this.Tickets.Count();
|
||||||
public void GetTicketsUpdates()
|
public void GetTicketsUpdates()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace TicketManager.Models
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public DateTime CreatedAt { get; } = DateTime.Now;
|
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||||
public DateTime PlannedEnding { get; set; }
|
public DateTime PlannedEnding { get; set; }
|
||||||
|
|
||||||
public Status Status { get; set; } = Status.ToDo;
|
public Status Status { get; set; } = Status.ToDo;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace TicketManager.Models
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
public string FullName => $"{FirstName} {LastName}";
|
public string FullName => $"{FirstName} {LastName}";
|
||||||
public string Presentation { get; set; }
|
public string Presentation { get; set; }
|
||||||
public DateTime Created_at { get; } = DateTime.Now;
|
public DateTime Created_at { get; set; } = DateTime.Now;
|
||||||
public byte[] Picture { get; set; }
|
public byte[] Picture { get; set; }
|
||||||
// public Role Role { get; set; }
|
// public Role Role { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
23
README.md
23
README.md
|
|
@ -4,6 +4,27 @@
|
||||||
|
|
||||||
- [Follow the link](https://docs.google.com/presentation/d/1Gunf5MRJ_KcoFwo0x_vV8YVHnf9l0V8n7BiJGz6p4cI/edit?usp=sharing)
|
- [Follow the link](https://docs.google.com/presentation/d/1Gunf5MRJ_KcoFwo0x_vV8YVHnf9l0V8n7BiJGz6p4cI/edit?usp=sharing)
|
||||||
|
|
||||||
## ToDo
|
## Features
|
||||||
|
|
||||||
|
## Supports
|
||||||
|
|
||||||
|
- Web
|
||||||
|
- Progressive Web App
|
||||||
|
- Mobile
|
||||||
|
|
||||||
|
## Technical Stack
|
||||||
|
|
||||||
|
- `React` client on the front-end (TypeScript)
|
||||||
|
- [Materialize](https://materializecss.com) CSS librairy for styling
|
||||||
|
- API: Newtonsoft.Json, to avoid cycle errors
|
||||||
|
- Hosting: ?
|
||||||
|
- Authentication : [Auth0](https://auth0.com/)
|
||||||
|
- Analytics : Google Analytics & Mixpanel
|
||||||
|
|
||||||
|
## Versions
|
||||||
|
|
||||||
|
### Features in v.0.1
|
||||||
|
|
||||||
|
## TO DO
|
||||||
|
|
||||||
- Write backend tests
|
- Write backend tests
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue