Skip to content

Commit 2bd8f7f

Browse files
committed
feat(notification): add new question notification
1 parent 6a3d2f9 commit 2bd8f7f

33 files changed

Lines changed: 1128 additions & 377 deletions

cmd/wire_gen.go

Lines changed: 15 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs.go

Lines changed: 48 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/swagger.json

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5154,29 +5154,6 @@
51545154
}
51555155
}
51565156
},
5157-
"/answer/api/v1/user/email/notification": {
5158-
"put": {
5159-
"description": "unsubscribe email notification",
5160-
"consumes": [
5161-
"application/json"
5162-
],
5163-
"produces": [
5164-
"application/json"
5165-
],
5166-
"tags": [
5167-
"User"
5168-
],
5169-
"summary": "unsubscribe email notification",
5170-
"responses": {
5171-
"200": {
5172-
"description": "OK",
5173-
"schema": {
5174-
"$ref": "#/definitions/handler.RespBody"
5175-
}
5176-
}
5177-
}
5178-
}
5179-
},
51805157
"/answer/api/v1/user/email/verification": {
51815158
"post": {
51825159
"description": "UserVerifyEmail",
@@ -5591,6 +5568,40 @@
55915568
}
55925569
}
55935570
},
5571+
"/answer/api/v1/user/notification/unsubscribe": {
5572+
"put": {
5573+
"description": "unsubscribe notification",
5574+
"consumes": [
5575+
"application/json"
5576+
],
5577+
"produces": [
5578+
"application/json"
5579+
],
5580+
"tags": [
5581+
"User"
5582+
],
5583+
"summary": "unsubscribe notification",
5584+
"parameters": [
5585+
{
5586+
"description": "UserUnsubscribeNotificationReq",
5587+
"name": "data",
5588+
"in": "body",
5589+
"required": true,
5590+
"schema": {
5591+
"$ref": "#/definitions/schema.UserUnsubscribeNotificationReq"
5592+
}
5593+
}
5594+
],
5595+
"responses": {
5596+
"200": {
5597+
"description": "OK",
5598+
"schema": {
5599+
"$ref": "#/definitions/handler.RespBody"
5600+
}
5601+
}
5602+
}
5603+
}
5604+
},
55945605
"/answer/api/v1/user/password": {
55955606
"put": {
55965607
"security": [
@@ -6212,7 +6223,7 @@
62126223
}
62136224
},
62146225
"definitions": {
6215-
"constant.NotificationChannel": {
6226+
"constant.NotificationChannelKey": {
62166227
"type": "string",
62176228
"enum": [
62186229
"email"
@@ -7762,7 +7773,7 @@
77627773
"type": "boolean"
77637774
},
77647775
"key": {
7765-
"$ref": "#/definitions/constant.NotificationChannel"
7776+
"$ref": "#/definitions/constant.NotificationChannelKey"
77667777
}
77677778
}
77687779
},
@@ -9577,6 +9588,18 @@
95779588
}
95789589
}
95799590
},
9591+
"schema.UserUnsubscribeNotificationReq": {
9592+
"type": "object",
9593+
"required": [
9594+
"code"
9595+
],
9596+
"properties": {
9597+
"code": {
9598+
"type": "string",
9599+
"maxLength": 500
9600+
}
9601+
}
9602+
},
95809603
"schema.VoteReq": {
95819604
"type": "object",
95829605
"required": [

docs/swagger.yaml

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
definitions:
2-
constant.NotificationChannel:
2+
constant.NotificationChannelKey:
33
enum:
44
- email
55
type: string
@@ -1092,7 +1092,7 @@ definitions:
10921092
enable:
10931093
type: boolean
10941094
key:
1095-
$ref: '#/definitions/constant.NotificationChannel'
1095+
$ref: '#/definitions/constant.NotificationChannelKey'
10961096
type: object
10971097
schema.NotificationClearIDRequest:
10981098
properties:
@@ -2351,6 +2351,14 @@ definitions:
23512351
required:
23522352
- e_mail
23532353
type: object
2354+
schema.UserUnsubscribeNotificationReq:
2355+
properties:
2356+
code:
2357+
maxLength: 500
2358+
type: string
2359+
required:
2360+
- code
2361+
type: object
23542362
schema.VoteReq:
23552363
properties:
23562364
captcha_code:
@@ -5513,21 +5521,6 @@ paths:
55135521
summary: send email to the user email then change their email
55145522
tags:
55155523
- User
5516-
/answer/api/v1/user/email/notification:
5517-
put:
5518-
consumes:
5519-
- application/json
5520-
description: unsubscribe email notification
5521-
produces:
5522-
- application/json
5523-
responses:
5524-
"200":
5525-
description: OK
5526-
schema:
5527-
$ref: '#/definitions/handler.RespBody'
5528-
summary: unsubscribe email notification
5529-
tags:
5530-
- User
55315524
/answer/api/v1/user/email/verification:
55325525
post:
55335526
consumes:
@@ -5778,6 +5771,28 @@ paths:
57785771
summary: update user's notification config
57795772
tags:
57805773
- User
5774+
/answer/api/v1/user/notification/unsubscribe:
5775+
put:
5776+
consumes:
5777+
- application/json
5778+
description: unsubscribe notification
5779+
parameters:
5780+
- description: UserUnsubscribeNotificationReq
5781+
in: body
5782+
name: data
5783+
required: true
5784+
schema:
5785+
$ref: '#/definitions/schema.UserUnsubscribeNotificationReq'
5786+
produces:
5787+
- application/json
5788+
responses:
5789+
"200":
5790+
description: OK
5791+
schema:
5792+
$ref: '#/definitions/handler.RespBody'
5793+
summary: unsubscribe notification
5794+
tags:
5795+
- User
57815796
/answer/api/v1/user/password:
57825797
put:
57835798
consumes:

i18n/en_US.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,11 @@ backend:
431431
other: "[{{.SiteName}}] {{.DisplayName}} commented on your post"
432432
body:
433433
other: "<strong><a href='{{.CommentUrl}}'>{{.QuestionTitle}}</a></strong><br><br>\n\n<small>{{.DisplayName}}:</small><br>\n<blockquote>{{.CommentSummary}}</blockquote><br>\n<a href='{{.CommentUrl}}'>View it on {{.SiteName}}</a><br><br>\n\n<small>You are receiving this because you authored the thread. <a href='{{.UnsubscribeUrl}}'>Unsubscribe</a></small>"
434+
new_question:
435+
title:
436+
other: "[{{.SiteName}}] New question: {{.QuestionTitle}}"
437+
body:
438+
other: "<strong><a href='{{.QuestionUrl}}'>{{.QuestionTitle}}</a></strong><br><br>\n\n<small>{{.Tags}}</small><br><br>\n\n<small><a href='{{.UnsubscribeUrl}}'>Unsubscribe</a></small>"
434439
pass_reset:
435440
title:
436441
other: "[{{.SiteName }}] Password reset"

0 commit comments

Comments
 (0)