Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial #3

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Initial #3

wants to merge 8 commits into from

Conversation

UnicoYal
Copy link
Collaborator

База для монолита на хттп

config/config.go Outdated Show resolved Hide resolved
config/config_methods.go Outdated Show resolved Hide resolved
config/config_methods.go Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
internal/app/api/implementation.go Show resolved Hide resolved
internal/app/router/router.go Outdated Show resolved Hide resolved
internal/app/service/service.go Show resolved Hide resolved
internal/db/db.go Outdated Show resolved Hide resolved
internal/db/db.go Outdated Show resolved Hide resolved
internal/db/db.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/context.go Outdated Show resolved Hide resolved
internal/app/router/router.go Outdated Show resolved Hide resolved
internal/app/app.go Show resolved Hide resolved
internal/app/app.go Outdated Show resolved Hide resolved
internal/config/config.yml Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved

func Login(ctx context.Context, api *api.Implementation, next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В мидлварю

Copy link
Collaborator

@Starlexxx Starlexxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Жду правки и тесты

func (a *App) GracefulShutdown() error {
log.Println("Starting graceful shutdown")

if err := a.Database.Close(); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

у тебя во время того, как выполняется шатдаун, апа все еще может принимать запросы, которые могут ходить в базу и тд. Нужно чтобы у приложения был стейт типа готово принимать, не готово или что-то подбное

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

странно, пускай будет просто internal/app/handlers/auth.go

"github.com/go-park-mail-ru/2024_2_GOATS/internal/app/models/cookie"
)

type AuthHandler struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Название структуры не должно начинаться с названия пакета

loginResp, errResp := a.ApiLayer.Login(a.Context, loginData)
if errResp != nil {
w.WriteHeader(errResp.StatusCode)
json.NewEncoder(w).Encode(errResp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

encode ошибку возвращает, надо обрабатывать

return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")

cookie, err := r.Cookie("session_id")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

коллизия с названием пакета

timeout: 4s
idleTimeout: 60s

# postgres: local
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

артефакт


INSERT INTO public.movies (title, country_id, description, release_date, movie_type)
VALUES
('Оно', 2, 'Когда в городке Дерри, штат Мэн, начинают пропадать дети, несколько ребят сталкиваются со своими величайшими страхами и вынуждены помериться силами со злобным клоуном Пеннивайзом, чьи проявления жестокости и список жертв уходят в глубь веков.', '2017-09-07', 'film'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не относится к схеме, это сиды

title varchar NOT NULL UNIQUE,
created_at timestamp WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT valid_title CHECK ( LENGTH(title) >= 3 )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лично я против валидаций на уровне бд, у тебя есть приложение для этого

username varchar UNIQUE,
email varchar NOT NULL UNIQUE,
password_hash varchar NOT NULL,
sex varchar CHECK(sex IN ('male', 'female', 'other', 'secret')),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

расточительство

album_url varchar DEFAULT '',
release_date date NOT NULL,
rating decimal(10,2) DEFAULT '0.0',
movie_type varchar CHECK(movie_type IN ('film', 'serial')),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

расточительство

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants