Skip to content

final project#1

Merged
o1uch merged 10 commits into
mainfrom
feature-project
Mar 25, 2026
Merged

final project#1
o1uch merged 10 commits into
mainfrom
feature-project

Conversation

@o1uch
Copy link
Copy Markdown
Owner

@o1uch o1uch commented Feb 25, 2026

No description provided.

Copy link
Copy Markdown

@dirtymew dirtymew left a comment

Choose a reason for hiding this comment

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

Привет Павел

хорошая работа - супер что делаешь задания со *

немного поправить и будет принята

Comment thread main.go
if err != nil {
log.Fatalf("db init failed: %v", err)
}
defer sqlDB.Close()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread main.go
api.Init(&store)
http.Handle("/", http.FileServer(http.Dir("./web")))

log.Printf("Server starting on %s", port)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread dockerfile Outdated

RUN CGO_ENABLED=0 GOOS=linux go build -o scheduler ./main.go

FROM ubuntu:latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

лучше брать образ полегче - типа alpine

Comment thread dockerfile Outdated

CMD ["./scheduler"]

# команда для запуска контейнера: docker run -d --name scheduler-container -p 7540:7540 -v "C:\path\to\db\scheduler.db:/data/scheduler.db" -e TODO_PASSWORD=12345 my-scheduler No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

это в документации лучше отражать

Comment thread Dockerfile
@@ -0,0 +1,28 @@
FROM golang:1.24.0-alpine AS builder
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

файл нужно назвать Dockerfile

Comment thread internal/db/db.go
}

if err := db.Ping(); err != nil {
return nil, fmt.Errorf("error checking the availability of the database: %w", err)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут нужно закрывать коннект

Comment thread internal/api/auth.go Outdated
return
}

envPass := os.Getenv("TODO_PASSWORD")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

так нужно не делать

считывать всю конфигурацию стоит один раз на старте

Comment thread internal/api/auth.go Outdated
func auth(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {

pass := os.Getenv("TODO_PASSWORD")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

см комментарий выше

Comment thread internal/api/api.go Outdated

newTask := store.Task{}

defer r.Body.Close()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

так не нужно делать на сервере

Comment thread tests/settings.go
var FullNextDate = false
var Search = false
var FullNextDate = true
var Search = true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

добавил авторизацию 👍 - нужно добавить Token для запуска тестов

@o1uch
Copy link
Copy Markdown
Owner Author

o1uch commented Feb 27, 2026

Привет ещё раз,
Поправил все основные замечания.
Добавил Token в tests/settings.go.
Теперь тесты должны проходить с авторизацией. Проверил локально — всё ок.

Copy link
Copy Markdown

@dirtymew dirtymew left a comment

Choose a reason for hiding this comment

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

Привет Павел

работа принята

поздравляю и желаю удачи 👍

Comment thread internal/store/store.go
}

type TaskFilter struct {
ByText bool
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

я бы советовал выделить абстракцию сервиса

транспорт(http) --> service(вся логика) --> storage

мб будет полезно

https://medium.com/@shershnev/layered-architecture-implementation-in-golang-6318a72c1e10

Comment thread tests/settings.go
var Token = ``
var FullNextDate = true
var Search = true
var Token = `5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

это не JWT токен

@o1uch o1uch merged commit 2e2f808 into main Mar 25, 2026
1 check passed
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