2021-05-08 22:25:31 +02:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ansible-semaphore/semaphore/db"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (d *BoltDb) GetRepository(projectID int, repositoryID int) (repository db.Repository, err error) {
|
2021-05-09 22:08:10 +02:00
|
|
|
err = d.getObject(projectID, db.RepositoryObject, intObjectID(repositoryID), &repository)
|
2021-05-08 22:25:31 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *BoltDb) GetRepositories(projectID int, params db.RetrieveQueryParams) (repositories []db.Repository, err error) {
|
2021-05-13 15:49:32 +02:00
|
|
|
err = d.getObjects(projectID, db.RepositoryObject, params, nil, &repositories)
|
2021-05-08 22:25:31 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *BoltDb) UpdateRepository(repository db.Repository) error {
|
|
|
|
return d.updateObject(repository.ProjectID, db.RepositoryObject, repository)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *BoltDb) CreateRepository(repository db.Repository) (db.Repository, error) {
|
|
|
|
newRepo, err := d.createObject(repository.ProjectID, db.RepositoryObject, repository)
|
|
|
|
return newRepo.(db.Repository), err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *BoltDb) DeleteRepository(projectID int, repositoryId int) error {
|
2021-05-09 22:08:10 +02:00
|
|
|
return d.deleteObject(projectID, db.RepositoryObject, intObjectID(repositoryId))
|
2021-05-08 22:25:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *BoltDb) DeleteRepositorySoft(projectID int, repositoryId int) error {
|
2021-05-09 22:08:10 +02:00
|
|
|
return d.deleteObjectSoft(projectID, db.RepositoryObject, intObjectID(repositoryId))
|
2021-05-08 22:25:31 +02:00
|
|
|
}
|
|
|
|
|