version 1
Build and Deploy / test-backend (push) Successful in 1m11s
Build and Deploy / lint-frontend (push) Successful in 21s
Build and Deploy / build-backend (push) Successful in 58s
Build and Deploy / deploy (push) Canceled after 0s
Build and Deploy / build-frontend (push) Canceled after 5m38s

This commit is contained in:
Ivan Rezchikov
2026-09-18 00:45:51 +03:00
commit 628dd6384b
149 changed files with 11478 additions and 0 deletions
@@ -0,0 +1,25 @@
package model
import (
"time"
"github.com/google/uuid"
)
type CollectionType string
const (
CollectionTypeAuto CollectionType = "auto"
CollectionTypeUser CollectionType = "user"
)
type Collection struct {
Id uuid.UUID `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Lang Language `json:"lang" db:"lang"`
UserID uuid.UUID `json:"user_id" db:"user_id"`
Words []string `json:"words" db:"words"`
Type CollectionType `json:"type" db:"type"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
}
+8
View File
@@ -0,0 +1,8 @@
package model
type KotosoftProfile struct {
ID string `json:"id"`
Email string `json:"email"`
FirstName string `json:"first_name"`
SecondName string `json:"second_name"`
}
+17
View File
@@ -0,0 +1,17 @@
package model
import (
"time"
"github.com/google/uuid"
)
type User struct {
Id uuid.UUID `json:"id" db:"id"`
KotosoftID string `json:"-" db:"kotosoft_id"`
Email string `json:"email" db:"email"`
FirstName string `json:"first_name" db:"first_name"`
SecondName string `json:"second_name" db:"second_name"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
}
+120
View File
@@ -0,0 +1,120 @@
package model
import (
"strings"
"time"
)
type Language string
type Source string
type PartOfSpeech string
const (
LangEN Language = "en"
LangIT Language = "it"
LangRU Language = "ru"
)
const (
Provider Source = "provider"
Cache Source = "cache"
)
func ParseLanguage(s string) (Language, bool) {
l := Language(strings.ToLower(strings.TrimSpace(s)))
if _, ok := languageCodes[l]; ok {
return l, true
}
return "", false
}
var languageCodes = map[Language]struct{}{
LangEN: {},
LangIT: {},
LangRU: {},
}
type Form struct {
Word string `json:"word"`
Tags []string `json:"tags,omitempty"`
}
type Quote struct {
Text string `json:"text"`
Reference string `json:"reference"`
}
type Sense struct {
Definition string `json:"definition"`
Tags []string `json:"tags,omitempty"`
Examples []string `json:"examples,omitempty"`
Quotes []Quote `json:"quotes,omitempty"`
Synonyms []string `json:"synonyms,omitempty"`
Antonyms []string `json:"antonyms,omitempty"`
}
type Entry struct {
Language Language `json:"language"`
PartOfSpeech PartOfSpeech `json:"partOfSpeech"`
IPA string `json:"ipa,omitempty"`
Forms []Form `json:"forms,omitempty"`
Senses []Sense `json:"senses"`
Synonyms []string `json:"synonyms,omitempty"`
Antonyms []string `json:"antonyms,omitempty"`
}
type TranslationResult struct {
SourceText string `json:"source_text"`
SourceLang Language `json:"source_lang"`
TargetLang Language `json:"target_lang"`
Translations []string `json:"translations"`
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
Source Source `json:"source"`
GeneratedAt *time.Time `json:"generated_at,omitempty"`
}
type DictionaryResult struct {
Word string `json:"word"`
Entries []Entry `json:"entries"`
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
Source Source `json:"source"`
GeneratedAt *time.Time `json:"generated_at,omitempty"`
}
type CollocationsResult struct {
Word string `json:"word"`
Lang Language `json:"lang"`
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
Source Source `json:"source"`
Collocations []string `json:"collocations"`
GeneratedAt *time.Time `json:"generated_at,omitempty"`
}
type ExamplesResult struct {
Word string `json:"word"`
Lang Language `json:"lang"`
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
Source Source `json:"source"`
Examples []string `json:"examples"`
GeneratedAt *time.Time `json:"generated_at,omitempty"`
}
type DeepLUsage struct {
CharacterCount int64 `json:"character_count"`
CharacterLimit int64 `json:"character_limit"`
}
type AIUsage struct {
Requests int64 `json:"requests"`
Tokens int64 `json:"tokens"`
TokenLimit int64 `json:"token_limit"`
}
type UsageResult struct {
DeepL *DeepLUsage `json:"deepl,omitempty"`
AI *AIUsage `json:"ai"`
}