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: Notifications CRD #550

Merged
merged 4 commits into from
Sep 14, 2023
Merged

feat: Notifications CRD #550

merged 4 commits into from
Sep 14, 2023

Conversation

adityathebe
Copy link
Member

Resolves: #547

"github.com/google/uuid"
)

func PersistNotificationFromCRD(obj *v1.Notification) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

@moshloop For all the CRD implemented resources, we have a spec column in the corresponding database table. However, notification is already built in a different way. We don't have a spec column for it.

Instead of modifying the notification table by removing existing columns and adding the spec column, I've implemented it this way. So far I don't really see why this would be an issue.

db/notifications.go Outdated Show resolved Hide resolved
Comment on lines 34 to 42
if uid, err := uuid.Parse(obj.Spec.To.Person); err == nil {
dbObj.PersonID = &uid
} else {
var person models.Person
if err := Gorm.Where("email = ?", obj.Spec.To.Person).First(&person).Error; err != nil {
return err
}
dbObj.PersonID = &person.ID
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we move these into a FindPerson/Team? - I also think the person lookup should be uuid, name or email and our docs to use Name so as not confuse with to.email which doesn't require a person object

Copy link
Member Author

Choose a reason for hiding this comment

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

I also think the person lookup should be uuid, name or email

people.name is not unique. Should we add that constraint?

@moshloop moshloop merged commit 7dd89ba into main Sep 14, 2023
5 checks passed
@moshloop moshloop deleted the feat/notification-crd branch September 14, 2023 09:55
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.

Notifications CRD
2 participants