File tree Expand file tree Collapse file tree 4 files changed +19
-17
lines changed
Expand file tree Collapse file tree 4 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -65,12 +65,12 @@ curl --location --request POST 'https://yourdomain.com/hook/feishu' \
6565
6666#### Webhook Handler Create Response
6767
68- Record your ` {webhook-id} ` .
68+ Record your ` {webhook-handler- id} ` .
6969
7070``` json
7171{
7272 "url" : " https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx" ,
73- "id" : " {webhook-id}" ,
73+ "id" : " {webhook-handler- id}" ,
7474 "title" : " webhook-name" ,
7575 "secret" : null
7676}
@@ -80,6 +80,8 @@ Record your `{webhook-id}`.
8080
8181Fill your github webhook form
8282
83- | Payload URL | Content type | SSL verification |
84- | ----------------------------------------------- | ---------------- | ----------------------- |
85- | https://yourdomain.com/hook/feishu/{webhook-id} | application/json | Enable SSL verification |
83+ | Field | Value |
84+ | ---------------- | ------------------------------------------------------- |
85+ | Payload URL | https://yourdomain.com/hook/feishu/{webhook-handler-id} |
86+ | Content type | application/json |
87+ | SSL verification | Enable SSL verification |
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ struct FeishuController: RouteCollection {
1212 }
1313 }
1414
15- func index( req: Request ) async throws -> [ FeishuWebhook ] {
16- try await FeishuWebhook . query ( on: req. db) . all ( )
15+ func index( req: Request ) async throws -> [ FeishuWebhookHandler ] {
16+ try await FeishuWebhookHandler . query ( on: req. db) . all ( )
1717 }
1818
1919 func forward( req: Request ) async throws -> HTTPStatus {
20- guard let webhook = try await FeishuWebhook . find ( req. parameters. get ( " webhookID " ) , on: req. db) else {
20+ guard let webhook = try await FeishuWebhookHandler . find ( req. parameters. get ( " webhookID " ) , on: req. db) else {
2121 throw Abort ( . notFound)
2222 }
2323
@@ -75,14 +75,14 @@ struct FeishuController: RouteCollection {
7575 return . ok
7676 }
7777
78- func create( req: Request ) async throws -> FeishuWebhook {
79- let todo = try req. content. decode ( FeishuWebhook . self)
78+ func create( req: Request ) async throws -> FeishuWebhookHandler {
79+ let todo = try req. content. decode ( FeishuWebhookHandler . self)
8080 try await todo. save ( on: req. db)
8181 return todo
8282 }
8383
8484 func delete( req: Request ) async throws -> HTTPStatus {
85- guard let todo = try await FeishuWebhook . find ( req. parameters. get ( " webhookID " ) , on: req. db) else {
85+ guard let todo = try await FeishuWebhookHandler . find ( req. parameters. get ( " webhookID " ) , on: req. db) else {
8686 throw Abort ( . notFound)
8787 }
8888 try await todo. delete ( on: req. db)
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import Fluent
22
33struct CreateFeishuWebhook : AsyncMigration {
44 func prepare( on database: Database ) async throws {
5- try await database. schema ( FeishuWebhook . schema)
5+ try await database. schema ( FeishuWebhookHandler . schema)
66 . id ( )
77 . field ( " title " , . string, . required)
88 . field ( " url " , . string, . required)
@@ -11,6 +11,6 @@ struct CreateFeishuWebhook: AsyncMigration {
1111 }
1212
1313 func revert( on database: Database ) async throws {
14- try await database. schema ( FeishuWebhook . schema) . delete ( )
14+ try await database. schema ( FeishuWebhookHandler . schema) . delete ( )
1515 }
1616}
Original file line number Diff line number Diff line change 11import Fluent
22import Vapor
33
4- final class FeishuWebhook : Model , Content {
4+ final class FeishuWebhookHandler : Model , Content {
55 static let schema = " feishu+webhook "
66 struct FieldKeys {
77 static var title : FieldKey { " title " }
@@ -12,13 +12,13 @@ final class FeishuWebhook: Model, Content {
1212 @ID ( key: . id)
1313 var id : UUID ?
1414
15- @Field ( key: FeishuWebhook . FieldKeys. title)
15+ @Field ( key: FeishuWebhookHandler . FieldKeys. title)
1616 var title : String
1717
18- @Field ( key: FeishuWebhook . FieldKeys. url)
18+ @Field ( key: FeishuWebhookHandler . FieldKeys. url)
1919 var url : String
2020
21- @OptionalField ( key: FeishuWebhook . FieldKeys. secret)
21+ @OptionalField ( key: FeishuWebhookHandler . FieldKeys. secret)
2222 var secret : String ?
2323
2424 init ( ) { }
You can’t perform that action at this time.
0 commit comments