@@ -338,54 +338,6 @@ func addNewDraftPost(ctx context.Context, c *cmd.AddNewDraftPost) error {
338338 })
339339}
340340
341- func getDraftPostByID (ctx context.Context , q * query.GetPostByID ) error {
342- return using (ctx , func (trx * dbx.Trx , tenant * entity.Tenant , user * entity.User ) error {
343- post := dbPost {}
344- err := trx .Get (& post , `
345- SELECT p.id,
346- p.number,
347- p.title,
348- p.slug,
349- p.description,
350- p.created_at,
351- 0 as votes_count,
352- 0 as comments_count,
353- 0 AS recent_votes_count,
354- 0 AS recent_comments_count,
355- p.status,
356- NULL AS user_id,
357- NULL AS user_name,
358- NULL AS user_email,
359- NULL AS user_role,
360- NULL AS user_status,
361- NULL AS user_avatar_type,
362- NULL AS user_avatar_bkey,
363- p.response,
364- p.response_date,
365- NULL AS response_user_id,
366- NULL AS response_user_name,
367- NULL AS response_user_email,
368- NULL AS response_user_role,
369- NULL AS response_user_status,
370- NULL AS response_user_avatar_type,
371- NULL AS response_user_avatar_bkey,
372- NULL AS original_number,
373- NULL AS original_title,
374- NULL AS original_slug,
375- NULL AS original_status,
376- ARRAY[]::text[] AS tags,
377- false AS has_voted
378- FROM posts p
379- WHERE p.id = $1
380- ` , q .PostID )
381- if err != nil {
382- return errors .Wrap (err , "failed to get draft post with id '%d'" , q .PostID )
383- }
384- q .Result = post .toModel (ctx )
385- return nil
386- })
387- }
388-
389341func updatePost (ctx context.Context , c * cmd.UpdatePost ) error {
390342 return using (ctx , func (trx * dbx.Trx , tenant * entity.Tenant , user * entity.User ) error {
391343 _ , err := trx .Execute (`UPDATE posts SET title = $1, slug = $2, description = $3
0 commit comments