package dao

import (
	"errors"
	"gorm.io/gorm"
	"youngee_b_api/app/entity"
)

type TaskLogisticsDao struct{}

func (d TaskLogisticsDao) SelectTaskLogistics(taskId string) (*entity.TaskLogistics, error) {
	var taskLogistics *entity.TaskLogistics
	err := Db.Model(&entity.TaskLogistics{}).Where("task_id = ?", taskId).Find(&taskLogistics).Error
	if err != nil {
		if errors.Is(err, gorm.ErrRecordNotFound) {
			return nil, nil
		}
		return nil, err
	}
	return taskLogistics, nil
}
