Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit438bcba

Browse files
committed
Review comments
Signed-off-by: Danny Kopping <danny@coder.com>
1 parentf53a8aa commit438bcba

File tree

10 files changed

+13
-103
lines changed

10 files changed

+13
-103
lines changed

‎coderd/database/dbauthz/dbauthz.go‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,13 +2501,6 @@ func (q *querier) InsertMissingGroups(ctx context.Context, arg database.InsertMi
25012501
returnq.db.InsertMissingGroups(ctx,arg)
25022502
}
25032503

2504-
func (q*querier)InsertNotificationTemplate(ctx context.Context,arg database.InsertNotificationTemplateParams) (database.NotificationTemplate,error) {
2505-
iferr:=q.authorizeContext(ctx,policy.ActionCreate,rbac.ResourceSystem);err!=nil {
2506-
return database.NotificationTemplate{},err
2507-
}
2508-
returnq.db.InsertNotificationTemplate(ctx,arg)
2509-
}
2510-
25112504
func (q*querier)InsertOAuth2ProviderApp(ctx context.Context,arg database.InsertOAuth2ProviderAppParams) (database.OAuth2ProviderApp,error) {
25122505
iferr:=q.authorizeContext(ctx,policy.ActionCreate,rbac.ResourceOauth2App);err!=nil {
25132506
return database.OAuth2ProviderApp{},err

‎coderd/database/dbauthz/dbauthz_test.go‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,10 +2461,6 @@ func (s *MethodTestSuite) TestSystemFunctions() {
24612461
// TODO: update this test once we have a specific role for notifications
24622462
check.Args(database.FetchNewMessageMetadataParams{}).Asserts(rbac.ResourceSystem,policy.ActionRead)
24632463
}))
2464-
s.Run("InsertNotificationTemplate",s.Subtest(func(db database.Store,check*expects) {
2465-
// TODO: update this test once we have a specific role for notifications
2466-
check.Args(database.InsertNotificationTemplateParams{}).Asserts(rbac.ResourceSystem,policy.ActionCreate)
2467-
}))
24682464
}
24692465

24702466
func (s*MethodTestSuite)TestOAuth2ProviderApps() {

‎coderd/database/dbmem/dbmem.go‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6108,14 +6108,6 @@ func (q *FakeQuerier) InsertMissingGroups(_ context.Context, arg database.Insert
61086108
returnnewGroups,nil
61096109
}
61106110

6111-
func (*FakeQuerier)InsertNotificationTemplate(_ context.Context,arg database.InsertNotificationTemplateParams) (database.NotificationTemplate,error) {
6112-
err:=validateDatabaseType(arg)
6113-
iferr!=nil {
6114-
return database.NotificationTemplate{},err
6115-
}
6116-
return database.NotificationTemplate{},nil
6117-
}
6118-
61196111
func (q*FakeQuerier)InsertOAuth2ProviderApp(_ context.Context,arg database.InsertOAuth2ProviderAppParams) (database.OAuth2ProviderApp,error) {
61206112
err:=validateDatabaseType(arg)
61216113
iferr!=nil {

‎coderd/database/dbmetrics/dbmetrics.go‎

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dbmock/dbmock.go‎

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
DROPTABLE IF EXISTS notification_messages;
22
DROPTABLE IF EXISTS notification_templates;
3-
DROPTYPE IF EXISTS notification_receiver;
43
DROPTYPE IF EXISTS notification_method;
54
DROPTYPE IF EXISTS notification_message_status;

‎coderd/database/migrations/testdata/fixtures/000219_notifications.up.sql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $$
1010
('b0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12','B', template, template,'Group 1'),
1111
('c0eebc99-9c0b-4ef8-bb6d-6bb9bd380a13','C', template, template,'Group 2');
1212

13-
INSERT INTOpublic.users(id, email, username, hashed_password, created_at, updated_at, status, rbac_roles, deleted)
13+
INSERT INTO users(id, email, username, hashed_password, created_at, updated_at, status, rbac_roles, deleted)
1414
VALUES ('fc1511ef-4fcf-4a3b-98a1-8df64160e35a','githubuser@coder.com','githubuser','\x','2022-11-02 13:05:21.445455+02','2022-11-02 13:05:21.445455+02','active','{}', false)ON CONFLICT DO NOTHING;
1515

1616
INSERT INTO notification_messages (id, notification_template_id, user_id, method, created_by, payload)

‎coderd/database/querier.go‎

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go‎

Lines changed: 6 additions & 44 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/notifications.sql‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
-- name: InsertNotificationTemplate :one
2-
INSERT INTO notification_templates (id, name, title_template, body_template,"group")
3-
VALUES ($1, $2, $3, $4, $5)
4-
RETURNING*;
5-
61
-- name: FetchNewMessageMetadata :one
72
-- This is used to build up the notification_message's JSON payload.
83
SELECTnt.nameAS notification_name,
@@ -47,7 +42,6 @@ WITH acquired AS (
4742
leased_until= NOW()+ CONCAT(sqlc.arg('lease_seconds')::int,' seconds')::interval
4843
WHERE idIN (SELECTnm.id
4944
FROM notification_messagesAS nm
50-
LEFT JOIN notification_templatesAS ntON (nm.notification_template_id=nt.id)
5145
WHERE (
5246
(
5347
-- message is in acquirable states
@@ -113,18 +107,17 @@ FROM (SELECT id, status, status_reason, failed_at
113107
WHEREnotification_messages.id=subquery.id;
114108

115109
-- name: BulkMarkNotificationMessagesSent :execrows
116-
WITH new_valuesAS (SELECT UNNEST(@ids::uuid[])AS id,
117-
UNNEST(@sent_ats::timestamptz[])AS sent_at)
118110
UPDATE notification_messages
119-
SET updated_at=subquery.sent_at,
111+
SET updated_at=new_values.sent_at,
120112
attempt_count= attempt_count+1,
121113
status='sent'::notification_message_status,
122114
status_reason=NULL,
123115
leased_until=NULL,
124116
next_retry_after=NULL
125-
FROM (SELECT id, sent_at
126-
FROM new_values)AS subquery
127-
WHEREnotification_messages.id=subquery.id;
117+
FROM (SELECT UNNEST(@ids::uuid[])AS id,
118+
UNNEST(@sent_ats::timestamptz[])AS sent_at)
119+
AS new_values
120+
WHEREnotification_messages.id=new_values.id;
128121

129122
-- Delete all notification messages which have not been updated for over a week.
130123
-- name: DeleteOldNotificationMessages :exec
@@ -133,7 +126,5 @@ FROM notification_messages
133126
WHERE idIN
134127
(SELECT id
135128
FROM notification_messagesAS nested
136-
WHEREnested.updated_at< NOW()- INTERVAL'7 days'
137-
-- ensure we don't clash with the notifier
138-
FORUPDATE SKIP LOCKED);
129+
WHEREnested.updated_at< NOW()- INTERVAL'7 days');
139130

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp