Create gists from git http server endpoint (#95)

This commit is contained in:
Thomas Miceli
2023-09-09 19:39:57 +02:00
committed by GitHub
parent 977fc9db28
commit 46dea89b41
10 changed files with 276 additions and 25 deletions

View File

@ -1,6 +1,7 @@
package db
import (
"github.com/labstack/echo/v4"
"github.com/thomiceli/opengist/internal/git"
"gorm.io/gorm"
"os/exec"
@ -190,6 +191,11 @@ func (gist *Gist) Update() error {
}
func (gist *Gist) Delete() error {
err := gist.DeleteRepository()
if err != nil {
return err
}
return db.Delete(&gist).Error
}
@ -260,6 +266,10 @@ func (gist *Gist) InitRepository() error {
return git.InitRepository(gist.User.Username, gist.Uuid)
}
func (gist *Gist) InitRepositoryViaNewPush(ctx echo.Context) error {
return git.InitRepositoryViaNewPush(gist.User.Username, gist.Uuid, ctx)
}
func (gist *Gist) DeleteRepository() error {
return git.DeleteRepository(gist.User.Username, gist.Uuid)
}