package newsrepository

import newsdomain "legalgo-BE-go/internal/domain/news"

func (a *accessor) GetByID(id string) (*newsdomain.News, error) {
	var news newsdomain.News

	if err := a.db.
		Preload("Tags").
		Preload("Categories").
		Preload("Author").
		First(&news, "id = ?", id).Error; err != nil {
		return nil, err
	}

	return &news, nil
}
