Added DeleteProject handler, untested
This commit is contained in:
parent
cd74758b2f
commit
dce91943b3
2 changed files with 13 additions and 1 deletions
|
@ -20,7 +20,7 @@ type Database interface {
|
|||
PromoteToAdmin(username string) error
|
||||
GetUserId(username string) (int, error)
|
||||
AddProject(name string, description string, username string) error
|
||||
// DeleteProject(name string, username string) error
|
||||
DeleteProject(name string, username string) error
|
||||
Migrate() error
|
||||
MigrateSampleData() error
|
||||
GetProjectId(projectname string) (int, error)
|
||||
|
|
|
@ -30,6 +30,18 @@ func (gs *GState) CreateProject(c *fiber.Ctx) error {
|
|||
return c.Status(200).SendString("Project added")
|
||||
}
|
||||
|
||||
func (gs *GState) DeleteProject(c *fiber.Ctx) error {
|
||||
|
||||
projectID := c.Params("projectID")
|
||||
username := c.Params("username")
|
||||
|
||||
if err := gs.Db.DeleteProject(projectID, username); err != nil {
|
||||
return c.Status(500).SendString((err.Error()))
|
||||
}
|
||||
|
||||
return c.Status(200).SendString("Project deleted")
|
||||
}
|
||||
|
||||
// GetUserProjects returns all projects that the user is a member of
|
||||
func (gs *GState) GetUserProjects(c *fiber.Ctx) error {
|
||||
// First we get the username from the token
|
||||
|
|
Loading…
Reference in a new issue