package newsrepository

import "legalgo-BE-go/database"

func (a *accessor) GetAllModel() ([]database.NewsModel, error) {
	var news []database.NewsModel

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

	return news, nil
}
