set project creator as member on creation

This commit is contained in:
Ruidy Nemausat 2020-05-05 15:11:53 +02:00
parent df38a0b74e
commit 302ca0c0ae
6 changed files with 12 additions and 8 deletions

View file

@ -180,11 +180,15 @@ namespace TicketManager.Controllers
EndingDate = projectDto.EndingDate,
Manager = await _context.AppUsers.FindAsync(projectDto.ManagerId)
};
// project.LogAction(
// $"{project.Title} has been created by {project.Manager.FullName}.",
// ActivityType.StartTask);
_context.Projects.Add(project);
_context.Assignments.Add(new Assignment()
{
Project = project,
ProjectId = project.Id,
User = project.Manager,
UserId = project.Manager.Id
});
await _context.SaveChangesAsync();
var dto = new ProjectDTO(project);
return CreatedAtAction("GetProject", new { id = project.Id }, dto);

View file

@ -11,6 +11,6 @@ namespace TicketManager.Resources
[Required]
public DateTime EndingDate { get; set; }
[Required]
public Guid ManagerId { get; set; }
public string ManagerId { get; set; }
}
}

BIN
app.db

Binary file not shown.

View file

@ -46,8 +46,7 @@ export default function ButtonAppBar() {
</IconButton>
<Typography variant="h6" className={classes.title}>
<Button color="inherit" component={Link} to={ROUTES.HOME}>
{/* <Button color="inherit" href={ROUTES.HOME}> */}
🐞BugBuster
BugBuster
</Button>
</Typography>
{!isAuthenticated ? (

View file

@ -1,4 +1,5 @@
import React, { FC } from "react";
import { Link as RouterLink } from "react-router-dom";
import { Container, Typography, Link } from "@material-ui/core";
import { makeStyles } from "@material-ui/core/styles";
@ -16,7 +17,7 @@ const Copyright: FC<IProps> = ({ brand, text }) => {
return (
<Typography variant="body2" color="textSecondary">
{"© "}
<Link color="inherit" href="/">
<Link color="inherit" component={RouterLink} to="/">
{brand}
</Link>{" "}
{new Date().getFullYear()}

View file

@ -22,7 +22,7 @@ const NewProjectModal: FC<IProps> = ({ show, handleClose }) => {
title: title,
description: description,
endingDate: new Date(endingDate).toISOString(),
managerId: getUID(user), // get current User id
managerId: getUID(user),
};
const token = await getTokenSilently();