func (r *GormCommentRevisionRepository) Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, c Comment) error {
	log.Debug(nil, map[string]interface{}{
		"modifier_id":   modifierID,
		"revision_type": revisionType,
	}, "Storing a revision after operation on comment.")
	tx := r.db
	revision := &Revision{
		ModifierIdentity: modifierID,
		Time:             time.Now(),
		Type:             revisionType,
		CommentID:        c.ID,
		CommentParentID:  c.ParentID,
		CommentBody:      &c.Body,
		CommentMarkup:    &c.Markup,
	}
	if revision.Type == RevisionTypeDelete {
		revision.CommentBody = nil
		revision.CommentMarkup = nil
	}

	if err := tx.Create(&revision).Error; err != nil {
		return errors.NewInternalError(fmt.Sprintf("failed to create new comment revision: %s", err.Error()))
	}
	log.Debug(ctx, map[string]interface{}{"comment_id": c.ID}, "comment revision occurrence created")
	return nil
}
// Create stores a new revision for the given comment.
Create stores a new revision for the given comment.
// Create stores a new revision for the given comment .
func (r *GormCommentRevisionRepository) Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, c Comment) error {
	log.Debug(nil, map[string]interface{}{
		"modifier_id":   modifierID,
		"revision_type": revisionType,
	}, "Storing a revision after operation on comment.")
	tx := r.db
	revision := &Revision{
		ModifierIdentity: modifierID,
		Time:             time.Now(),
		Type:             revisionType,
		CommentID:        c.ID,
		CommentParentID:  c.ParentID,
		CommentBody:      &c.Body,
		CommentMarkup:    &c.Markup,
	}
	if revision.Type == RevisionTypeDelete {
		revision.CommentBody = nil
		revision.CommentMarkup = nil
	}
	if err := tx.Create(&revision).Error; err != nil {
		return errors.NewInternalError(fmt.Sprintf("failed to create new comment revision: %s", err.Error()))
	}
	log.Debug(ctx, map[string]interface{}{"comment_id": c.ID}, "comment revision occurrence created")
	return nil
}
func ( r * GormCommentRevisionRepository ) Create ( ctx context . Context , modifierID uuid . UUID , revisionType RevisionType , c Comment ) error { log . Debug ( nil , map [ string ] interface { } { " " : modifierID , " " : revisionType , } , " " ) tx := r . db revision := & Revision { ModifierIdentity : modifierID , Time : time . Now ( ) , Type : revisionType , CommentID : c . ID , CommentParentID : c . ParentID , CommentBody : & c . Body , CommentMarkup : & c . Markup , } if revision . Type == RevisionTypeDelete { revision . CommentBody = nil revision . CommentMarkup = nil } if err := tx . Create ( & revision ) . Error ; err != nil { return errors . NewInternalError ( fmt . Sprintf ( " " , err . Error ( ) ) ) } log . Debug ( ctx , map [ string ] interface { } { " " : c . ID } , " " ) return nil }
Create stores a new revision for the given comment.
Create stores a new revision for the given comment .