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

feat(api): add emergency contacts database functions #1081

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

almostinf
Copy link
Member

@almostinf almostinf commented Sep 10, 2024

Add emergency contacts database functions

Added database functions for emergency contacts - these are the contacts to which notifications will go to users in case of emergency types of problems in Moira

@almostinf almostinf marked this pull request as ready for review September 10, 2024 11:07
@almostinf almostinf requested a review from a team as a code owner September 10, 2024 11:08
datatypes.go Outdated Show resolved Hide resolved
datatypes.go Outdated Show resolved Hide resolved
}

emergencyContact, getEmergencyContactErr := connector.GetEmergencyContact(contactID)
if getEmergencyContactErr != nil && !errors.Is(getEmergencyContactErr, database.ErrNil) {
Copy link
Member

Choose a reason for hiding this comment

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

Если есть эмёрдженси контакт -- мы удаляем и его? Может логика должна быть наоборот, как с подписками и контактами: сначала удалите все зависимости, а потом только удаляйте контакты

Copy link
Member Author

Choose a reason for hiding this comment

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Вынесу в общее обсуждение

Copy link
Member

Choose a reason for hiding this comment

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

Просто в рамках логики апи это разные штуки. Это в рамках логики фронта надо запросы по очереди отправлять

type HeartbeatType string

const (
HearbeatTypeNotSet HeartbeatType = "type_not_set"
Copy link
Member

@AleksandrMatsko AleksandrMatsko Oct 2, 2024

Choose a reason for hiding this comment

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

Suggested change
HearbeatTypeNotSet HeartbeatType = "type_not_set"
HeartbeatTypeNotSet HeartbeatType = "type_not_set"

?

// IsValid checks if such an heartbeat type exists.
func (heartbeatType HeartbeatType) IsValid() bool {
switch heartbeatType {
case HeartbeatNotifierOff:
Copy link
Member

Choose a reason for hiding this comment

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

А почему решил сюда не добавлять type_not_set?

@kissken kissken self-requested a review October 4, 2024 11:54
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.

4 participants