Added user authentication
This commit is contained in:
parent
d7e7af5a10
commit
cb54057305
40 changed files with 710 additions and 218 deletions
|
|
@ -40,6 +40,19 @@ func (s *Service) GetPost(ctx context.Context, id int) (models.Post, error) {
|
|||
return post, nil
|
||||
}
|
||||
|
||||
func (s *Service) DeletePost(ctx context.Context, site models.Site, id int) error {
|
||||
post, err := s.db.GetPost(ctx, int64(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := s.db.DeletePost(ctx, int64(id)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return s.jobs.Queue(ctx, s.sb.DeletePost(site, post))
|
||||
}
|
||||
|
||||
func (s *Service) Create(ctx context.Context, site models.Site, req NewPost) (models.Post, error) {
|
||||
post := models.Post{
|
||||
SiteID: site.ID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue