init commit
This commit is contained in:
14
proto/store/activity.proto
Normal file
14
proto/store/activity.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.store;
|
||||
|
||||
option go_package = "gen/store";
|
||||
|
||||
message ActivityMemoCommentPayload {
|
||||
int32 memo_id = 1;
|
||||
int32 related_memo_id = 2;
|
||||
}
|
||||
|
||||
message ActivityPayload {
|
||||
ActivityMemoCommentPayload memo_comment = 1;
|
||||
}
|
||||
33
proto/store/attachment.proto
Normal file
33
proto/store/attachment.proto
Normal file
@@ -0,0 +1,33 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.store;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "store/workspace_setting.proto";
|
||||
|
||||
option go_package = "gen/store";
|
||||
|
||||
enum AttachmentStorageType {
|
||||
ATTACHMENT_STORAGE_TYPE_UNSPECIFIED = 0;
|
||||
// Attachment is stored locally. AKA, local file system.
|
||||
LOCAL = 1;
|
||||
// Attachment is stored in S3.
|
||||
S3 = 2;
|
||||
// Attachment is stored in an external storage. The reference is a URL.
|
||||
EXTERNAL = 3;
|
||||
}
|
||||
|
||||
message AttachmentPayload {
|
||||
oneof payload {
|
||||
S3Object s3_object = 1;
|
||||
}
|
||||
|
||||
message S3Object {
|
||||
StorageS3Config s3_config = 1;
|
||||
// key is the S3 object key.
|
||||
string key = 2;
|
||||
// last_presigned_time is the last time the object was presigned.
|
||||
// This is used to determine if the presigned URL is still valid.
|
||||
google.protobuf.Timestamp last_presigned_time = 3;
|
||||
}
|
||||
}
|
||||
41
proto/store/idp.proto
Normal file
41
proto/store/idp.proto
Normal file
@@ -0,0 +1,41 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.store;
|
||||
|
||||
option go_package = "gen/store";
|
||||
|
||||
message IdentityProvider {
|
||||
int32 id = 1;
|
||||
string name = 2;
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
OAUTH2 = 1;
|
||||
}
|
||||
Type type = 3;
|
||||
string identifier_filter = 4;
|
||||
IdentityProviderConfig config = 5;
|
||||
}
|
||||
|
||||
message IdentityProviderConfig {
|
||||
oneof config {
|
||||
OAuth2Config oauth2_config = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message FieldMapping {
|
||||
string identifier = 1;
|
||||
string display_name = 2;
|
||||
string email = 3;
|
||||
string avatar_url = 4;
|
||||
}
|
||||
|
||||
message OAuth2Config {
|
||||
string client_id = 1;
|
||||
string client_secret = 2;
|
||||
string auth_url = 3;
|
||||
string token_url = 4;
|
||||
string user_info_url = 5;
|
||||
repeated string scopes = 6;
|
||||
FieldMapping field_mapping = 7;
|
||||
}
|
||||
15
proto/store/inbox.proto
Normal file
15
proto/store/inbox.proto
Normal file
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.store;
|
||||
|
||||
option go_package = "gen/store";
|
||||
|
||||
message InboxMessage {
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
MEMO_COMMENT = 1;
|
||||
VERSION_UPDATE = 2;
|
||||
}
|
||||
Type type = 1;
|
||||
optional int32 activity_id = 2;
|
||||
}
|
||||
29
proto/store/memo.proto
Normal file
29
proto/store/memo.proto
Normal file
@@ -0,0 +1,29 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.store;
|
||||
|
||||
option go_package = "gen/store";
|
||||
|
||||
message MemoPayload {
|
||||
Property property = 1;
|
||||
|
||||
Location location = 2;
|
||||
|
||||
repeated string tags = 3;
|
||||
|
||||
// The calculated properties from the memo content.
|
||||
message Property {
|
||||
bool has_link = 1;
|
||||
bool has_task_list = 2;
|
||||
bool has_code = 3;
|
||||
bool has_incomplete_tasks = 4;
|
||||
// The references of the memo. Should be a list of uuid.
|
||||
repeated string references = 5;
|
||||
}
|
||||
|
||||
message Location {
|
||||
string placeholder = 1;
|
||||
double latitude = 2;
|
||||
double longitude = 3;
|
||||
}
|
||||
}
|
||||
107
proto/store/user_setting.proto
Normal file
107
proto/store/user_setting.proto
Normal file
@@ -0,0 +1,107 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.store;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/store";
|
||||
|
||||
message UserSetting {
|
||||
enum Key {
|
||||
KEY_UNSPECIFIED = 0;
|
||||
// General user settings.
|
||||
GENERAL = 1;
|
||||
// User authentication sessions.
|
||||
SESSIONS = 2;
|
||||
// Access tokens for the user.
|
||||
ACCESS_TOKENS = 3;
|
||||
// The shortcuts of the user.
|
||||
SHORTCUTS = 4;
|
||||
// The webhooks of the user.
|
||||
WEBHOOKS = 5;
|
||||
}
|
||||
|
||||
int32 user_id = 1;
|
||||
|
||||
Key key = 2;
|
||||
oneof value {
|
||||
GeneralUserSetting general = 3;
|
||||
SessionsUserSetting sessions = 4;
|
||||
AccessTokensUserSetting access_tokens = 5;
|
||||
ShortcutsUserSetting shortcuts = 6;
|
||||
WebhooksUserSetting webhooks = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message GeneralUserSetting {
|
||||
// The user's locale.
|
||||
string locale = 1;
|
||||
// The user's appearance setting.
|
||||
string appearance = 2;
|
||||
// The user's memo visibility setting.
|
||||
string memo_visibility = 3;
|
||||
// The user's theme preference.
|
||||
// This references a CSS file in the web/public/themes/ directory.
|
||||
string theme = 4;
|
||||
}
|
||||
|
||||
message SessionsUserSetting {
|
||||
message Session {
|
||||
// Unique session identifier.
|
||||
string session_id = 1;
|
||||
// Timestamp when the session was created.
|
||||
google.protobuf.Timestamp create_time = 2;
|
||||
// Timestamp when the session was last accessed.
|
||||
// Used for sliding expiration calculation (last_accessed_time + 2 weeks).
|
||||
google.protobuf.Timestamp last_accessed_time = 3;
|
||||
// Client information associated with this session.
|
||||
ClientInfo client_info = 4;
|
||||
}
|
||||
|
||||
message ClientInfo {
|
||||
// User agent string of the client.
|
||||
string user_agent = 1;
|
||||
// IP address of the client.
|
||||
string ip_address = 2;
|
||||
// Optional. Device type (e.g., "mobile", "desktop", "tablet").
|
||||
string device_type = 3;
|
||||
// Optional. Operating system (e.g., "iOS 17.0", "Windows 11").
|
||||
string os = 4;
|
||||
// Optional. Browser name and version (e.g., "Chrome 119.0").
|
||||
string browser = 5;
|
||||
}
|
||||
|
||||
repeated Session sessions = 1;
|
||||
}
|
||||
|
||||
message AccessTokensUserSetting {
|
||||
message AccessToken {
|
||||
// The access token is a JWT token.
|
||||
// Including expiration time, issuer, etc.
|
||||
string access_token = 1;
|
||||
// A description for the access token.
|
||||
string description = 2;
|
||||
}
|
||||
repeated AccessToken access_tokens = 1;
|
||||
}
|
||||
|
||||
message ShortcutsUserSetting {
|
||||
message Shortcut {
|
||||
string id = 1;
|
||||
string title = 2;
|
||||
string filter = 3;
|
||||
}
|
||||
repeated Shortcut shortcuts = 1;
|
||||
}
|
||||
|
||||
message WebhooksUserSetting {
|
||||
message Webhook {
|
||||
// Unique identifier for the webhook
|
||||
string id = 1;
|
||||
// Descriptive title for the webhook
|
||||
string title = 2;
|
||||
// The webhook URL endpoint
|
||||
string url = 3;
|
||||
}
|
||||
repeated Webhook webhooks = 1;
|
||||
}
|
||||
120
proto/store/workspace_setting.proto
Normal file
120
proto/store/workspace_setting.proto
Normal file
@@ -0,0 +1,120 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.store;
|
||||
|
||||
option go_package = "gen/store";
|
||||
|
||||
enum WorkspaceSettingKey {
|
||||
WORKSPACE_SETTING_KEY_UNSPECIFIED = 0;
|
||||
// BASIC is the key for basic settings.
|
||||
BASIC = 1;
|
||||
// GENERAL is the key for general settings.
|
||||
GENERAL = 2;
|
||||
// STORAGE is the key for storage settings.
|
||||
STORAGE = 3;
|
||||
// MEMO_RELATED is the key for memo related settings.
|
||||
MEMO_RELATED = 4;
|
||||
}
|
||||
|
||||
message WorkspaceSetting {
|
||||
WorkspaceSettingKey key = 1;
|
||||
oneof value {
|
||||
WorkspaceBasicSetting basic_setting = 2;
|
||||
WorkspaceGeneralSetting general_setting = 3;
|
||||
WorkspaceStorageSetting storage_setting = 4;
|
||||
WorkspaceMemoRelatedSetting memo_related_setting = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceBasicSetting {
|
||||
// The secret key for workspace. Mainly used for session management.
|
||||
string secret_key = 1;
|
||||
// The current schema version of database.
|
||||
string schema_version = 2;
|
||||
}
|
||||
|
||||
message WorkspaceGeneralSetting {
|
||||
// theme is the name of the selected theme.
|
||||
// This references a CSS file in the web/public/themes/ directory.
|
||||
string theme = 1;
|
||||
// disallow_user_registration disallows user registration.
|
||||
bool disallow_user_registration = 2;
|
||||
// disallow_password_auth disallows password authentication.
|
||||
bool disallow_password_auth = 3;
|
||||
// additional_script is the additional script.
|
||||
string additional_script = 4;
|
||||
// additional_style is the additional style.
|
||||
string additional_style = 5;
|
||||
// custom_profile is the custom profile.
|
||||
WorkspaceCustomProfile custom_profile = 6;
|
||||
// week_start_day_offset is the week start day offset from Sunday.
|
||||
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
|
||||
// Default is Sunday.
|
||||
int32 week_start_day_offset = 7;
|
||||
// disallow_change_username disallows changing username.
|
||||
bool disallow_change_username = 8;
|
||||
// disallow_change_nickname disallows changing nickname.
|
||||
bool disallow_change_nickname = 9;
|
||||
}
|
||||
|
||||
message WorkspaceCustomProfile {
|
||||
string title = 1;
|
||||
string description = 2;
|
||||
string logo_url = 3;
|
||||
string locale = 4;
|
||||
string appearance = 5;
|
||||
}
|
||||
|
||||
message WorkspaceStorageSetting {
|
||||
enum StorageType {
|
||||
STORAGE_TYPE_UNSPECIFIED = 0;
|
||||
// STORAGE_TYPE_DATABASE is the database storage type.
|
||||
DATABASE = 1;
|
||||
// STORAGE_TYPE_LOCAL is the local storage type.
|
||||
LOCAL = 2;
|
||||
// STORAGE_TYPE_S3 is the S3 storage type.
|
||||
S3 = 3;
|
||||
}
|
||||
// storage_type is the storage type.
|
||||
StorageType storage_type = 1;
|
||||
// The template of file path.
|
||||
// e.g. assets/{timestamp}_{filename}
|
||||
string filepath_template = 2;
|
||||
// The max upload size in megabytes.
|
||||
int64 upload_size_limit_mb = 3;
|
||||
// The S3 config.
|
||||
StorageS3Config s3_config = 4;
|
||||
}
|
||||
|
||||
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
|
||||
message StorageS3Config {
|
||||
string access_key_id = 1;
|
||||
string access_key_secret = 2;
|
||||
string endpoint = 3;
|
||||
string region = 4;
|
||||
string bucket = 5;
|
||||
bool use_path_style = 6;
|
||||
}
|
||||
|
||||
message WorkspaceMemoRelatedSetting {
|
||||
// disallow_public_visibility disallows set memo as public visibility.
|
||||
bool disallow_public_visibility = 1;
|
||||
// display_with_update_time orders and displays memo with update time.
|
||||
bool display_with_update_time = 2;
|
||||
// content_length_limit is the limit of content length. Unit is byte.
|
||||
int32 content_length_limit = 3;
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
bool enable_double_click_edit = 4;
|
||||
// enable_link_preview enables links preview.
|
||||
bool enable_link_preview = 5;
|
||||
// enable_comment enables comment.
|
||||
bool enable_comment = 6;
|
||||
// reactions is the list of reactions.
|
||||
repeated string reactions = 7;
|
||||
// disable markdown shortcuts
|
||||
bool disable_markdown_shortcuts = 8;
|
||||
// enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
|
||||
bool enable_blur_nsfw_content = 9;
|
||||
// nsfw_tags is the list of tags that mark content as NSFW for blurring.
|
||||
repeated string nsfw_tags = 10;
|
||||
}
|
||||
Reference in New Issue
Block a user