Skip to content

feat(API): Add API client, Zod Schemas, Endpoints and Stores - #2

Open
Kazuto wants to merge 9 commits into
developfrom
feat/api
Open

feat(API): Add API client, Zod Schemas, Endpoints and Stores#2
Kazuto wants to merge 9 commits into
developfrom
feat/api

Conversation

@Kazuto

@Kazuto Kazuto commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

This PR introduces a comprehensive API layer with REST endpoints, request/response schemas, and global authentication middleware. It establishes state management for core entities (Definitions, Entries, Users) and implements a permission system using the v-can directive.

Changes

  • API Layer: Added endpoints and schemas for Definitions, Entries, Localizations, Roles, Terminology, Users, and Locale management.
  • Authentication: Implemented global authentication middleware (auth.global.ts) and an Auth Store for session management.
  • State Management: Created Pinia-style stores for all core entities to manage application state.
  • UI & Permissions: Added v-can directive for permission-based rendering, application layouts (default and auth), and a dashboard page.
  • Composables: Introduced useApi and usePermission composable functions for easy access to API instances and permission checks.
  • App Structure: Updated app.vue to use NuxtLayout for proper routing structure.

Test Plan

  • API Endpoints: Verify that all new API endpoints (Definitions, Entries, etc.) return correct JSON schemas and handle requests.
  • Authentication: Confirm that the global middleware blocks unauthenticated requests to protected routes.
  • Permission Directive: Test v-can directive by ensuring elements are hidden or removed when the user lacks specific permissions.
  • State Management: Verify that stores correctly sync data from API calls and persist user state across navigation.

Kazuto added 7 commits May 14, 2026 16:06
- Create API client builder with public and authed endpoint configurations.
- Define authentication endpoints (register, login, refresh token, logout).
- Define user management endpoints (list, get, create) with Zod schemas.
- Replaced NuxtWelcome/RouteAnnouncer in app.vue with NuxtLayout.
- Created auth and default layout components for application shell.
- Added index.vue page with permission-based card grid.
- Exclude `/login` from protected route checks.
- Redirect unauthenticated users to login page for protected routes.
- Prevent logged-in users from accessing `/login` page.
- Added `locale.ts` endpoint definitions for CRUD and default locale operations.
- Created `CommonSchema.ts` with pagination request and response schemas.
- Updated `app/lib/api/index.ts` to register the new locale endpoints.
- Define DefinitionSchema with full CRUD operations
- Define EntrySchema with full CRUD operations
- Add Locale, Localization, Permission, Role, Terminology, User schemas
- Update common.ts with shared pagination logic
- Export all schemas in index.ts
… Roles, Terminologies, and Users

- Added definitions endpoint with CRUD operations
- Added entries endpoint with CRUD operations
- Added localizations endpoint with CRUD operations
- Added roles endpoint with CRUD operations
- Added terminologies endpoint with CRUD operations
- Added users endpoint with CRUD operations
- Updated index.ts to export new endpoints
…lizations, Roles, Terminology, and Users

- Added useDefinitionStore with pagination support
- Added useEntryStore with pagination support
- Added useLocaleStore with pagination support
- Added useLocalizationStore with pagination support
- Added useRoleStore with pagination support
- Added useTerminologyStore with pagination support
- Added useUserStore with pagination support
Kazuto added 2 commits June 4, 2026 16:31
…ology schemas

- Extend `EntrySchema` with a `localizations` array.
- Extend `TerminologySchema` with a `definitions` array.
- Add Permission type imports to usePermission.ts and can.ts
- Filter out null permissions in permission checks across composable and directive
- Update RoleSchema to allow nullable arrays for permissions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant