package db

import (
	"context"
	"github.com/sirupsen/logrus"
	"youngee_b_api/model/gorm_model"
)

// FindProjectBriefByProjectId 根据projectId查找Brief
func FindProjectBriefByProjectId(ctx context.Context, projectId string) ([]*gorm_model.YounggeeProjectBrief, error) {
	db := GetReadDB(ctx)
	var sProjectInfo []*gorm_model.YounggeeProjectBrief
	// 1. 根据服务商种草任务id过滤
	err := db.Model(gorm_model.YounggeeProjectBrief{}).Where("project_id = ?", projectId).Find(&sProjectInfo).Error
	if err != nil {
		logrus.WithContext(ctx).Errorf("[GetSProjectDetail] error query mysql, err:%+v", err)
		return nil, err
	}
	return sProjectInfo, nil
}
