Commit Graph

322 Commits

Author SHA1 Message Date
Claude 133695da24
refactor(api): standardize API structure per Google AIP
This commit addresses API design inconsistencies identified during
standardization review against Google AIP (API Improvement Proposals)
and REST API best practices.

## Changes Made

### 1. WorkspaceSetting Resource Namespace (proto)
- Fixed: `api.memos.dev/WorkspaceSetting` → `memos.api.v1/WorkspaceSetting`
- Location: proto/api/v1/workspace_service.proto (lines 57, 181)
- Impact: Aligns with consistent namespace pattern used across all other resources

### 2. Identity Provider HTTP Paths (proto)
- Changed: `/api/v1/identityProviders` → `/api/v1/identity-providers`
- Changed: `identityProviders/{idp}` → `identity-providers/{idp}`
- Location: proto/api/v1/idp_service.proto (all HTTP annotations and resource pattern)
- Rationale: REST conventions prefer lowercase with hyphens (kebab-case) over camelCase
- Follows: GitHub API standards and industry best practices

### 3. Backend Resource Name Constants (Go)
- Updated: `IdentityProviderNamePrefix = "identity-providers/"`
- Location: server/router/api/v1/resource_name.go:19
- Impact: Ensures resource name parsing matches new proto pattern

### 4. Backend Tests (Go)
- Updated all hardcoded identity provider resource names
- Location: server/router/api/v1/test/idp_service_test.go
- Changed: `identityProviders/*` → `identity-providers/*` (4 occurrences)

### 5. Frontend Constants (TypeScript)
- Updated: `identityProviderNamePrefix = "identity-providers/"`
- Location: web/src/store/common.ts:4
- Impact: Frontend resource name handling aligns with backend

## Breaking Changes

⚠️ **IMPORTANT**: This is a breaking change for Identity Provider API consumers.

**Before:**
```
GET /api/v1/identityProviders
GET /api/v1/identityProviders/123
```

**After:**
```
GET /api/v1/identity-providers
GET /api/v1/identity-providers/123
```

**Migration:** API clients must update URLs from `identityProviders` to `identity-providers`.

## Next Steps Required

1. **Regenerate proto code** (requires buf CLI):
   ```bash
   cd proto
   buf generate
   ```
   This will update:
   - proto/gen/api/v1/*.pb.go (Go generated code)
   - proto/gen/api/v1/*.pb.gw.go (gRPC-Gateway code)
   - web/src/types/proto/api/v1/*.ts (TypeScript definitions)
   - proto/gen/openapi.yaml (OpenAPI spec)

2. **Test thoroughly:**
   - Backend tests: `go test ./server/router/api/v1/test/...`
   - Frontend integration tests
   - Manual API testing with new paths

3. **Update documentation:**
   - API documentation mentioning identity provider endpoints
   - Migration guides for existing API consumers

## References
- Google AIP-122: Resource names
- Google AIP-132: Standard List methods
- REST API naming conventions (lowercase with hyphens)
- GitHub API design standards

## Binary Endpoint Design (No Changes)
After research, confirmed that the current `/file/*` path for binary content
is correct and follows best practices:
- Separates binary content delivery from structured API responses
- Enables easier CDN integration and caching
- Follows Google's pattern of using google.api.HttpBody with distinct paths
2025-11-05 08:33:00 +00:00
Steven bc1550e926 refactor(api): migrate inbox functionality to user notifications
- Remove standalone InboxService and move functionality to UserService
- Rename inbox to user notifications for better API consistency
- Add ListUserNotifications, UpdateUserNotification, DeleteUserNotification methods
- Update frontend components to use new notification endpoints
- Update store layer to support new notification model

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 08:33:09 +08:00
Steven 243ecf14b0 refactor(api): remove DeleteMemoTag and RenameMemoTag endpoints
BREAKING CHANGE: Removed DeleteMemoTag and RenameMemoTag API endpoints
for better API consistency. Tags should now be managed by updating memo
content directly via UpdateMemo endpoint.

Backend changes:
- Remove RenameMemoTag and DeleteMemoTag RPC methods from proto
- Remove backend implementations in memo_service.go
- Regenerate protocol buffers (Go, TypeScript, OpenAPI)

Frontend changes:
- Remove RenameTagDialog component
- Simplify TagsSection to remove rename/delete functionality
- Improve tag styling with active state highlighting
- Add smooth transitions and better hover interactions
- Polish TagTree component for consistency
- Tags now only support click-to-filter (no inline editing)

Style improvements:
- Active tags highlighted with primary color and font-medium
- Consistent hover states across flat and tree views
- Better spacing and visual hierarchy
- Improved empty state styling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 23:32:47 +08:00
Claude 7eec424274 chore: remove references handling from markdown extraction 2025-10-27 00:12:24 +08:00
Claude 739fd2cde6 refactor: update markdown parser
- Removed the `nodes` field from the `Memo` interface in `memo_service.ts`.
- Updated the `createBaseMemo` function and the `Memo` message functions to reflect the removal of `nodes`.
- Cleaned up the serialization and deserialization logic accordingly.

chore: remove code-inspector-plugin from Vite configuration

- Deleted the `codeInspectorPlugin` from the Vite configuration in `vite.config.mts`.
- Simplified the plugins array to include only `react` and `tailwindcss`.
2025-10-26 11:28:40 +08:00
Steven 9121ddbad9 feat(api): support username lookup in GetUser endpoint
- Update GetUser to accept both numeric IDs and username strings (users/{id} or users/{username})
- Implement CEL filter parsing for username-based lookups
- Update proto documentation to reflect dual lookup capability
- Simplify frontend user store to use GetUser instead of ListUsers filter
- Update ListUsers filter documentation to show current capabilities
2025-10-22 21:48:34 +08:00
Steven b4ea7d843f feat: enhance memo sorting functionality to support multiple fields 2025-10-20 23:41:58 +08:00
github-actions[bot] 074c580214 chore: bump gomark
- Bump protoc-gen-go version from v1.36.8 to v1.36.9 in multiple generated files.
- Enhance OpenAPI descriptions for various endpoints to improve clarity and readability.
- Fix typo in the description list handling in the markdown service.
- Update HTMLElement component to handle children and self-closing tags correctly.
- Modify types in the markdown service to include children and self-closing properties for HTML elements.
2025-09-28 16:15:55 +08:00
Johnny 7cc2df9254 chore: fix linter 2025-08-31 20:22:32 +08:00
Johnny e93f3cbb8b refactor: unify theme and apperance 2025-08-17 11:27:59 +08:00
Liu Chao ba7dfb7d98
fix: OpenAPI Parameter Conflict in DeleteMemoTag Endpoint (#4985)
Signed-off-by: ChaoLiu <chaoliu719@gmail.com>
2025-08-13 07:14:18 +08:00
johnnyjoy 506b477d50 fix: get user by username 2025-08-04 19:56:12 +08:00
Steven 1fcafd807e chore: enable memo comments by default 2025-07-29 22:31:18 +08:00
Johnny 8f51791da8 chore: update user setting definition 2025-07-29 09:21:51 +08:00
johnnyjoy c5d497a1f0 chore: update user settings 2025-07-27 23:12:42 +08:00
johnnyjoy 3f56ce47d2 chore: update definition of workspace setting 2025-07-27 15:50:09 +08:00
johnnyjoy db63b1949a chore: fix creator id format 2025-07-23 22:18:47 +08:00
johnnyjoy ed23cbc011 refactor: memo filter 2025-07-23 22:10:16 +08:00
Steven ac386c218d fix: workspace setting keys 2025-07-22 22:59:54 +08:00
johnnyjoy 6e45e9f8b6 refactor: deprecate old filter 2025-07-22 21:25:57 +08:00
Johnny 71181b1640 chore: update openapi version 2025-07-20 12:02:16 +08:00
Steven 533591af2b chore: theme in user setting 2025-07-08 19:50:04 +08:00
Johnny 1b3083b216
feat: themes (#4824) 2025-07-07 20:13:22 +08:00
Johnny 240d89fbca feat: migrate dialogs 2025-07-06 22:01:55 +08:00
johnnyjoy 1fffc41f79 feat: sliding expiration for user sessions 2025-06-26 23:03:28 +08:00
Steven 42d1650c6d chore: tweak auth service 2025-06-24 23:31:37 +08:00
johnnyjoy 976bd332fe chore: fix linter 2025-06-24 21:55:27 +08:00
johnnyjoy d6a75bba4c refactor: webhook service 2025-06-24 21:28:21 +08:00
Johnny e6e460493c refactor: general user setting 2025-06-23 23:23:57 +08:00
Johnny 9b15936873 refactor: clean unused fields 2025-06-23 22:55:14 +08:00
Steven 83febf9928 chore: clean resource definition 2025-06-23 21:08:25 +08:00
Steven 5821bb7a65 chore: update auth service 2025-06-23 20:31:18 +08:00
Johnny 4e3a4e36f6 feat: implement user sessions 2025-06-23 09:13:51 +08:00
Johnny 77b7fc4441 feat: implement user session 2025-06-22 12:46:13 +08:00
Johnny 741fe35c2a refactor: rename session methods in auth service 2025-06-21 00:00:58 +08:00
Steven 35df62a96c chore: remove duplicated prefix from enums 2025-06-18 22:40:54 +08:00
Steven d71fd2f84a refactor: auth service 2025-06-18 20:25:46 +08:00
Steven 9972a77d9e refactor: memo service 2025-06-18 19:58:38 +08:00
Steven 91c2a4cef9 refactor: inbox service 2025-06-18 19:06:09 +08:00
Steven a4920d464b refactor: attachment service part2 2025-06-18 00:09:19 +08:00
Steven bb5809cae4 refactor: attachment service 2025-06-17 22:15:19 +08:00
Steven 174b1a0361 chore: fix linter 2025-06-17 21:04:28 +08:00
Steven f6e5da4499 refator: activity service 2025-06-17 09:00:03 +08:00
Steven dac059a7f7 refactor: identity provider service 2025-06-16 23:56:28 +08:00
Steven 8d8e9b3b30 refactor: shortcut service 2025-06-16 23:10:50 +08:00
Steven 1ea4cc453c refactor: workspace setting service 2025-06-16 22:51:26 +08:00
Steven da906c665c chore: tweak workspace service 2025-06-16 22:20:10 +08:00
Steven 3b0c87591f refactor: webhook service 2025-06-16 22:10:43 +08:00
Steven c9ab03e1a0 refactor: user service 2025-06-16 21:49:38 +08:00
Steven 64b27d5a4e refactor: shortcut service 2025-05-26 21:45:14 +08:00