const EmbeddingRepository =
require("../repositories/embedding.repository");

class EmbeddingService {

    static async save(data) {

        const existing =
        await EmbeddingRepository.findByStudentId(
            data.student_id
        );

        if(existing){

            return EmbeddingRepository.update(

                data.student_id,

                data

            );

        }

        return EmbeddingRepository.create(data);

    }

    static async get(studentId){

        return EmbeddingRepository.findByStudentId(

            studentId

        );

    }

    static async getAll(){

        return EmbeddingRepository.findAll();

    }

}

module.exports = EmbeddingService;