Skip to content

Commit

Permalink
Merge pull request #471 from carbon-bond/robot-account
Browse files Browse the repository at this point in the history
機器人帳號
  • Loading branch information
MROS authored Apr 5, 2023
2 parents cf400a7 + 20ab94b commit 39711f1
Show file tree
Hide file tree
Showing 57 changed files with 2,372 additions and 1,280 deletions.
36 changes: 30 additions & 6 deletions api-service/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions api-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ warp = {version = "0.3.2", features = ["compression-gzip"]}
futures = "0.3.13"
urlencoding = "2.1.0"
lettre = { version = "0.10.2", features = ["tokio1-native-tls"]}
hex = "0.4.3"
hmac = "0.12.1"
sha2 = "0.10.6"

[dependencies.openssl]
version = "0.10.29"
Expand Down
4 changes: 4 additions & 0 deletions api-service/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,9 @@ fn gen_api_files() -> std::io::Result<()> {
client_file.write_all(custom_error::gen_typescript().as_bytes())?;
chitin_entry.root_codegen(&client_option, &mut client_file)?;

let mut webhook_file = File::create("../frontend/lib/api/webhook_type.ts")?;
webhook_file.write_all(b"/*eslint-disable*/\n")?;
webhook_file.write_all(model::webhook::gen_typescript().as_bytes())?;

Ok(())
}
15 changes: 15 additions & 0 deletions api-service/migrations/20230226161606_robots.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ALTER TABLE users
ADD COLUMN api_key_hashed bytea DEFAULT NULL,
ADD COLUMN api_key_tail varchar(5) DEFAULT NULL,
ADD COLUMN is_robot boolean NOT NULL DEFAULT FALSE;

ALTER TYPE notification_kind ADD VALUE 'mention';

CREATE TABLE webhooks (
id bigserial PRIMARY KEY,
user_id bigint REFERENCES users (id) NOT NULL,
target_url text NOT NULL,
secret varchar(32) NOT NULL DEFAULT '',
create_time timestamptz NOT NULL DEFAULT NOW()
-- event_set notification_kind,
);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TYPE notification_kind ADD VALUE 'mentioned_in_comment';
Loading

0 comments on commit 39711f1

Please sign in to comment.