mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
feat: add notifications inbox db (#16599)
This PR is linked [to the following issue](https://github.com/coder/internal/issues/334). The objective is to create the DB layer and migration for the new `Coder Inbox`.
This commit is contained in:
@ -450,6 +450,22 @@ func OrganizationMember(t testing.TB, db database.Store, orig database.Organizat
|
||||
return mem
|
||||
}
|
||||
|
||||
func NotificationInbox(t testing.TB, db database.Store, orig database.InsertInboxNotificationParams) database.InboxNotification {
|
||||
notification, err := db.InsertInboxNotification(genCtx, database.InsertInboxNotificationParams{
|
||||
ID: takeFirst(orig.ID, uuid.New()),
|
||||
UserID: takeFirst(orig.UserID, uuid.New()),
|
||||
TemplateID: takeFirst(orig.TemplateID, uuid.New()),
|
||||
Targets: takeFirstSlice(orig.Targets, []uuid.UUID{}),
|
||||
Title: takeFirst(orig.Title, testutil.GetRandomName(t)),
|
||||
Content: takeFirst(orig.Content, testutil.GetRandomName(t)),
|
||||
Icon: takeFirst(orig.Icon, ""),
|
||||
Actions: orig.Actions,
|
||||
CreatedAt: takeFirst(orig.CreatedAt, dbtime.Now()),
|
||||
})
|
||||
require.NoError(t, err, "insert notification")
|
||||
return notification
|
||||
}
|
||||
|
||||
func Group(t testing.TB, db database.Store, orig database.Group) database.Group {
|
||||
t.Helper()
|
||||
|
||||
|
Reference in New Issue
Block a user