usecase

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAvatarsAndBlankFile

func CreateAvatarsAndBlankFile(request *http.Request, objectRequest infrastructure.StorageObjectRequest) (infrastructure.SignedURLs, error)

func CreateBackgroundMusicAndBlankFile

func CreateBackgroundMusicAndBlankFile(request *http.Request, param *CreateBackgroundMusicParam) (infrastructure.SignedURL, error)

func CreateGraphicsAndBlankFiles

func CreateGraphicsAndBlankFiles(request *http.Request, objectRequest infrastructure.StorageObjectRequest) (infrastructure.SignedURLs, error)

func CreateIntroductionLesson

func CreateIntroductionLesson(request *http.Request, needsRecording bool, lesson *domain.Lesson) error

CreateIntroductionLessonは、自己紹介用のLessonを作成します。自己紹介に必要なGraphicも、既存のPublicGraphicから作成します。 自己紹介授業を複数作成することはできないため、Lesson作成後にエラーが発生した場合はLessonの削除を試みます。 Graphicはユーザーによる削除が可能なので、重複制限を行わず、Graphic作成後にエラーが発生してもロールバックは試みません。 LessonMaterialも、Lessonの削除後に残り続けても実害はないのでロールバックは試みません。

func CreateLesson

func CreateLesson(request *http.Request, newLesson *NewLessonParams, lesson *domain.Lesson) error

CreateLesson is create the new lesson belongs to subject and category.

func CreateLessonThumbnailBlankFile

func CreateLessonThumbnailBlankFile(request *http.Request, isPublic bool, id int64) (string, error)

CreateLessonThumbnailBlankFile is create blank image file to public or private bucket.

func CreateSynthesisVoice

func CreateSynthesisVoice(request *http.Request, params *domain.CreateSynthesisVoiceParam) (domain.Voice, error)

CreateSynthesisVoiceAndBlankFile creates Voice and blank files of mp3 and wav.

func CreateUser

func CreateUser(request *http.Request, newUser *NewUserParams) error

CreateUserは新規ユーザーを作成します。

func CreateUserThumbnailBlankFile

func CreateUserThumbnailBlankFile(request *http.Request) (string, error)

CreateLessonThumbnailBlankFile is create blank image file.

func CreateVoiceAndBlankFile

func CreateVoiceAndBlankFile(request *http.Request, params *CreateVoiceParam) (domain.Voice, string, error)

CreateVoiceAndBlankFile creates Voice and blank mp3 file.

func DeleteGraphic

func DeleteGraphic(request *http.Request, id int64) error

func DeleteLessonAndResources

func DeleteLessonAndResources(id int64, request *http.Request) error

func GetAllCategories

func GetAllCategories(request *http.Request) ([]domain.ShortCategory, error)

GetCategory return all categories.

func GetAvailableAvatars

func GetAvailableAvatars(request *http.Request) ([]domain.Avatar, error)

GetAvailableAvatars for fetch avatar object from Cloud Datastore

func GetBackgroundImages

func GetBackgroundImages(request *http.Request) ([]domain.BackgroundImage, error)

GetBackgroundImages returns image URLs in Cloud Datastore.

func GetBackgroundMusics

func GetBackgroundMusics(request *http.Request) ([]domain.BackgroundMusic, error)

GetBackgroundMusics returns music URLs in Cloud Datastore.

func GetCategories

func GetCategories(request *http.Request, subjectID int64) ([]domain.ShortCategory, error)

GetCategories return categories by the subject.

func GetCategory

func GetCategory(request *http.Request, id int64, subjectID int64) (domain.Category, error)

GetCategory return a category by id.

func GetCurrentUser

func GetCurrentUser(request *http.Request) (domain.User, error)

GetCurrentUser for fetch current user account

func GetCurrentUserLessons

func GetCurrentUserLessons(request *http.Request) ([]domain.Lesson, error)

func GetGraphicByID

func GetGraphicByID(request *http.Request, id int64) (domain.Graphic, error)

GetGraphicByID is fetching a graphic by id.

func GetGraphicsByLessonID

func GetGraphicsByLessonID(request *http.Request, lessonID int64) ([]*domain.Graphic, error)

GetGraphicsByLessonID is fetching graphics belongs to lesson.

func GetGraphicsByLessonIDAndIDs

func GetGraphicsByLessonIDAndIDs(request *http.Request, lessonID int64, userID int64, ids []string) (map[int64]string, error)

func GetLessonMaterial

func GetLessonMaterial(request *http.Request, id int64, lessonID int64) (domain.LessonMaterial, error)

func GetLessonsByCategoryID

func GetLessonsByCategoryID(request *http.Request, categoryID int64, cursorStr string) ([]domain.ShortLesson, string, error)

GetLessonsByCategoryID for search lessons

func GetPrivateLesson

func GetPrivateLesson(request *http.Request, id int64) (domain.Lesson, error)

func GetPublicLesson

func GetPublicLesson(request *http.Request, id int64, viewKey string) (domain.Lesson, error)

GetPublicLesson for fetch the lesson by id

func GetPublicLessonsByUser

func GetPublicLessonsByUser(request *http.Request, userID int64) ([]domain.Lesson, error)

func GetSubjects

func GetSubjects(request *http.Request) ([]domain.Subject, error)

GetSubjects for fetch avatar object from Cloud Datastore

func GetUser

func GetUser(request *http.Request, id int64) (domain.User, error)

GetUserはidからユーザーを取得して返します。

func GetUsers

func GetUsers(request *http.Request, cursorStr string) ([]domain.User, string, error)

GetUsersは複数のユーザーを取得して返します。cursorStrがあればページネーションに使用し、なければ1件目からユーザーを返します。

func GetVoices

func GetVoices(request *http.Request, lessonID int64) ([]domain.Voice, error)

func UnsubscribeCurrentUser

func UnsubscribeCurrentUser(request *http.Request) error

func UpdateLessonMaterial

func UpdateLessonMaterial(request *http.Request, id int64, lessonID int64, params *map[string]interface{}) error

func UpdateLessonViewCount

func UpdateLessonViewCount(request *http.Request, lessonID int64) error

UpdateLessonViewCountは、lessonIDのLessonのViewCountを増分します。

func UpdateLessonWithMaterial

func UpdateLessonWithMaterial(id int64, request *http.Request, needsCopyThumbnail bool, requestID string, params *map[string]interface{}) error

func UpdateUser

func UpdateUser(request *http.Request, params *map[string]interface{}) (domain.User, error)

Types

type CreateBackgroundMusicParam

type CreateBackgroundMusicParam struct {
	Name string `json:"name"`
}

type CreateVoiceParam

type CreateVoiceParam struct {
	LessonID    int64   `json:"lessonID"`
	ElapsedTime float32 `json:"elapsedTime"`
	DurationSec float32 `json:"durationSec"`
}

type LessonErrorCode

type LessonErrorCode uint
const (
	LessonNotFound      LessonErrorCode = 1
	LessonNotAvailable  LessonErrorCode = 2
	InvalidLessonParams LessonErrorCode = 3
)

func (LessonErrorCode) Error

func (e LessonErrorCode) Error() string

type LessonMaterialErrorCode

type LessonMaterialErrorCode uint
const (
	LessonMaterialNotAvailable LessonMaterialErrorCode = 1
	LessonMaterialNotFound     LessonMaterialErrorCode = 2
)

func (LessonMaterialErrorCode) Error

func (e LessonMaterialErrorCode) Error() string

type NewLessonMaterialParams

type NewLessonMaterialParams struct {
	DurationSec          float32                     `json:"durationSec"`
	AvatarID             int64                       `json:"avatarID"`
	AvatarLightColor     string                      `json:"avatarLightColor"`
	BackgroundImageID    int64                       `json:"backgroundImageID"`
	VoiceSynthesisConfig domain.VoiceSynthesisConfig `json:"voiceSynthesisConfig"`
	Avatars              []domain.LessonAvatar       `json:"avatars"`
	Drawings             []domain.LessonDrawing      `json:"drawings"`
	Embeddings           []domain.LessonEmbedding    `json:"embeddings"`
	Graphics             []domain.LessonGraphic      `json:"graphics"`
	Musics               []domain.LessonMusic        `json:"musics"`
	Speeches             []domain.LessonSpeech       `json:"speeches"`
}

NewLessonMaterialParams

type NewLessonParams

type NewLessonParams struct {
	NeedsRecording     bool   `json:"needsRecording"`
	IsIntroduction     bool   `json:"isIntroduction"`
	SubjectID          int64  `json:"subjectID"`
	JapaneseCategoryID int64  `json:"japaneseCategoryID"`
	Title              string `json:"title"`
}

NewLessonParamsは、Lessonの新規作成時、リクエストボディをbindするために使用されます。

type NewUserParams

type NewUserParams struct {
	Name    string `json:"name" datastore:",noindex"`
	Profile string `json:"profile" datastore:",noindex"`
	Email   string `json:"email" datastore:",noindex"`
}

NewUserParamsは、Userの新規作成時、リクエストボディをbindするために使用されます。

type UserErrorCode

type UserErrorCode uint
const (
	UserNotAvailable  UserErrorCode = 1
	AlreadyUserExists UserErrorCode = 2
	UserNotFound      UserErrorCode = 3
)

func (UserErrorCode) Error

func (e UserErrorCode) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL