2024-08-18 18:03:24 +00:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-10-05 16:05:29 +00:00
|
|
|
"git.sch9.ru/new_gate/models"
|
2024-08-18 18:03:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type LanguageStorage interface {
|
2024-08-25 16:20:14 +00:00
|
|
|
ReadLanguageById(ctx context.Context, id int32) (*models.Language, error)
|
2024-08-18 18:03:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type LanguageService struct {
|
|
|
|
languageStorage LanguageStorage
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewLanguageService(
|
|
|
|
languageStorage LanguageStorage,
|
|
|
|
) *LanguageService {
|
|
|
|
return &LanguageService{
|
|
|
|
languageStorage: languageStorage,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-25 16:20:14 +00:00
|
|
|
func (service *LanguageService) ReadLanguageById(ctx context.Context, id int32) (*models.Language, error) {
|
2024-08-20 22:54:46 +00:00
|
|
|
//userId := ctx.Value("user_id").(int32)
|
2024-08-18 18:03:24 +00:00
|
|
|
panic("access control is not implemented yet")
|
|
|
|
return service.languageStorage.ReadLanguageById(ctx, id)
|
|
|
|
}
|