new features
This commit is contained in:
@@ -0,0 +1,176 @@
|
|||||||
|
# Kotosoft ID - AI System Documentation
|
||||||
|
|
||||||
|
This document is written for AI assistants (and developers) that need a fast, practical understanding of this repository.
|
||||||
|
|
||||||
|
## What this system is
|
||||||
|
|
||||||
|
Kotosoft ID is an identity and OAuth service with:
|
||||||
|
|
||||||
|
- a Go backend (`kotosoft-id-backend`) exposing OAuth and user/profile APIs,
|
||||||
|
- a Next.js frontend (`kotosoft-id-frontend`) handling login/consent UI and token cookies,
|
||||||
|
- PostgreSQL + Redis as dependencies.
|
||||||
|
|
||||||
|
Main use cases:
|
||||||
|
|
||||||
|
- OAuth2 Authorization Code + PKCE login flow,
|
||||||
|
- access/refresh token issuance and refresh,
|
||||||
|
- user profile management,
|
||||||
|
- consent management,
|
||||||
|
- role/permission ("positions") administration.
|
||||||
|
|
||||||
|
## Repository structure
|
||||||
|
|
||||||
|
- `kotosoft-id-backend`: Go API service (Gin, pgx, redis, JWT logic)
|
||||||
|
- `kotosoft-id-frontend`: Next.js app (App Router, server actions)
|
||||||
|
- `docker-compose.yml`: production-style compose wiring backend + frontend images
|
||||||
|
- `.drone.yml`: CI/CD pipeline (backend tests, frontend lint, image build/push, deploy)
|
||||||
|
|
||||||
|
## Runtime architecture (high-level)
|
||||||
|
|
||||||
|
1. Frontend starts OAuth initiation (`/api/auth/initiate`) and creates PKCE verifier/state cookies.
|
||||||
|
2. Browser is redirected to backend `/oauth/authorize`.
|
||||||
|
3. Backend creates OAuth session and redirects to frontend `/oauth?session=...`.
|
||||||
|
4. Frontend login/consent UI calls backend session endpoints (`/oauth/session/*`).
|
||||||
|
5. Backend returns redirect URL with authorization code.
|
||||||
|
6. Frontend callback exchanges code at backend `/oauth/token`.
|
||||||
|
7. Frontend stores access/refresh tokens in cookies and calls protected APIs.
|
||||||
|
8. On 401, frontend attempts refresh token flow.
|
||||||
|
|
||||||
|
## Backend API surface
|
||||||
|
|
||||||
|
Key groups from router:
|
||||||
|
|
||||||
|
- OAuth routes (`/oauth`)
|
||||||
|
- `GET /authorize`
|
||||||
|
- `GET /session/:token`
|
||||||
|
- `POST /session/login`
|
||||||
|
- `POST /session/attach`
|
||||||
|
- `POST /session/approve`
|
||||||
|
- `POST /token`
|
||||||
|
- `POST /revoke`
|
||||||
|
- `POST /introspect`
|
||||||
|
- User routes (`/api/v1`)
|
||||||
|
- `POST /auth/register`
|
||||||
|
- `POST /auth/refresh`
|
||||||
|
- `GET /me`
|
||||||
|
- `PATCH /me`
|
||||||
|
- `DELETE /me`
|
||||||
|
- `GET /me/consents`
|
||||||
|
- `DELETE /me/consent/:clientId`
|
||||||
|
- `GET /me/positions`
|
||||||
|
- Admin routes (`/api/v1/admin`)
|
||||||
|
- CRUD for permissions
|
||||||
|
- CRUD for positions
|
||||||
|
- assign/revoke positions to users
|
||||||
|
|
||||||
|
Security notes:
|
||||||
|
|
||||||
|
- protected routes require Bearer access token,
|
||||||
|
- scopes are checked in middleware,
|
||||||
|
- admin group additionally requires admin middleware,
|
||||||
|
- register/login are rate-limited.
|
||||||
|
|
||||||
|
## Required environment variables
|
||||||
|
|
||||||
|
### Backend
|
||||||
|
|
||||||
|
- `SERVER_ADDR` (default `:8080`)
|
||||||
|
- `FRONTEND_URL` (required)
|
||||||
|
- `POSTGRES_URL` (required)
|
||||||
|
- `POSTGRES_MIGRATION_FILE_PATH` (required)
|
||||||
|
- `REDIS_URL` (required)
|
||||||
|
- `JWT_SECRET` (required)
|
||||||
|
- `JWT_TTL` (default `24h`)
|
||||||
|
- `CLIENT_ID` (required)
|
||||||
|
- `CLIENT_SECRET` (required)
|
||||||
|
- `CLIENT_NAME` (optional, default `Basic Client`)
|
||||||
|
- `CLIENT_REDIRECT_URIS` (comma-separated)
|
||||||
|
- optional: `CLIENT_GRANT_TYPES`, `CLIENT_SCOPES`
|
||||||
|
|
||||||
|
### Frontend
|
||||||
|
|
||||||
|
- `PUBLIC_URL` (used for callback URI generation)
|
||||||
|
- `KOTOSOFT_ID_API_URL` (backend base URL)
|
||||||
|
- `CLIENT_ID`
|
||||||
|
- `CLIENT_SECRET`
|
||||||
|
|
||||||
|
## How to run locally (development)
|
||||||
|
|
||||||
|
Prerequisites:
|
||||||
|
|
||||||
|
- Go `1.25.x`
|
||||||
|
- Node `20+`
|
||||||
|
- PostgreSQL
|
||||||
|
- Redis
|
||||||
|
|
||||||
|
### Backend
|
||||||
|
|
||||||
|
1. `cd kotosoft-id-backend`
|
||||||
|
2. Set required env vars (or create `.env`)
|
||||||
|
3. Run:
|
||||||
|
- `go mod tidy`
|
||||||
|
- `go run ./cmd`
|
||||||
|
|
||||||
|
On startup backend:
|
||||||
|
|
||||||
|
- connects to Postgres/Redis,
|
||||||
|
- runs SQL migrations from `migrations/migrations.sql`,
|
||||||
|
- seeds/upserts OAuth client from env vars.
|
||||||
|
|
||||||
|
### Frontend
|
||||||
|
|
||||||
|
1. `cd kotosoft-id-frontend`
|
||||||
|
2. Install deps: `npm install`
|
||||||
|
3. Set env vars (`PUBLIC_URL`, `KOTOSOFT_ID_API_URL`, `CLIENT_ID`, `CLIENT_SECRET`)
|
||||||
|
4. Run dev server: `npm run dev`
|
||||||
|
|
||||||
|
## How to run in containers
|
||||||
|
|
||||||
|
The provided `docker-compose.yml` expects prebuilt images:
|
||||||
|
|
||||||
|
- `localhost:5000/kotosoft_id_backend:latest`
|
||||||
|
- `localhost:5000/kotosoft_id_frontend:latest`
|
||||||
|
|
||||||
|
Typical deployment flow is in `.drone.yml`:
|
||||||
|
|
||||||
|
- test backend,
|
||||||
|
- lint frontend,
|
||||||
|
- build and push both images,
|
||||||
|
- deploy with `docker compose up -d`.
|
||||||
|
|
||||||
|
## Is it functional?
|
||||||
|
|
||||||
|
Short answer: **yes, likely functional as a working auth system**, with normal production caveats.
|
||||||
|
|
||||||
|
Why this is likely:
|
||||||
|
|
||||||
|
- backend has organized routing/handlers/services/repositories,
|
||||||
|
- OAuth code flow + refresh + revoke + introspect are implemented,
|
||||||
|
- user profile and consent endpoints are implemented,
|
||||||
|
- admin permission/position features are implemented,
|
||||||
|
- CI runs `go test ./...` for backend and `npm run lint` for frontend.
|
||||||
|
|
||||||
|
Caveats:
|
||||||
|
|
||||||
|
- no explicit end-to-end test workflow is defined in CI,
|
||||||
|
- local functionality still depends on correct Postgres/Redis/env configuration,
|
||||||
|
- deployment compose relies on external image registry and external `proxy` network.
|
||||||
|
|
||||||
|
## Important operational notes for AI agents
|
||||||
|
|
||||||
|
- Do not assume public API docs exist; use backend router/handlers as source of truth.
|
||||||
|
- Frontend auth relies on server-side environment variables and secure cookie handling.
|
||||||
|
- Many failures are configuration failures (wrong redirect URI, client secret, DB/Redis URLs).
|
||||||
|
- If debugging auth, verify in this order:
|
||||||
|
1. env vars, 2) OAuth session lifecycle, 3) callback exchange, 4) cookie presence, 5) token refresh.
|
||||||
|
- For permission issues, check both access token scopes and user admin flag.
|
||||||
|
|
||||||
|
## Suggested next docs to add
|
||||||
|
|
||||||
|
If you want this project to be easier for both humans and AIs, add:
|
||||||
|
|
||||||
|
- a root `README.md` with quick-start commands,
|
||||||
|
- an `.env.example` for backend and frontend,
|
||||||
|
- a simple API reference table with request/response examples,
|
||||||
|
- an end-to-end "happy path" auth walkthrough.
|
||||||
|
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# Code Style Profile (Go + JSX/Next.js)
|
||||||
|
|
||||||
|
This document captures your current coding style as seen in the repository and lists questions to refine your preferred style rules.
|
||||||
|
|
||||||
|
## Go Style (Observed)
|
||||||
|
|
||||||
|
### What is consistent
|
||||||
|
- Clear layered architecture: `handlers -> services -> repositories`.
|
||||||
|
- Short, readable functions with early returns over deep nesting.
|
||||||
|
- Explicit request/response DTO structs in handlers with Gin binding tags.
|
||||||
|
- Business logic mostly lives in `services`, SQL mostly in `repositories`.
|
||||||
|
- Error mapping style is pragmatic (`models.ErrBadRequest`, `ErrForbidden`, etc.).
|
||||||
|
- Naming is mostly clear and domain-driven (`AssignPosition`, `RecordUserConsent`, `GetUserPositions`).
|
||||||
|
|
||||||
|
### Style characteristics
|
||||||
|
- You prefer practical over abstract code (few interfaces beyond service boundaries).
|
||||||
|
- You accept some inline structs for one-off request payloads.
|
||||||
|
- You keep SQL as raw strings in repository methods (not hidden behind ORM abstractions).
|
||||||
|
- You usually avoid over-commenting; code is expected to be self-explanatory.
|
||||||
|
- You follow `gofmt` defaults and avoid stylistic tricks.
|
||||||
|
|
||||||
|
## JSX / Next.js Style (Observed)
|
||||||
|
|
||||||
|
### What is consistent
|
||||||
|
- Functional components with hooks (`useState`, `useForm`, `useTranslations`).
|
||||||
|
- Strong TypeScript typing for props and form data.
|
||||||
|
- UI composition via reusable primitives (`Dialog`, `Table`, `Button`, custom fields).
|
||||||
|
- Local optimistic state updates after server actions.
|
||||||
|
- Short handlers with readable names (`handleCreated`, `handleUpdated`, `handleDelete`).
|
||||||
|
- Frequent early exits on failure (`if (!result.success) { ... return }`).
|
||||||
|
|
||||||
|
### Style characteristics
|
||||||
|
- You favor compact code and inlined JSX in places where intent is obvious.
|
||||||
|
- You rely on server actions for API calls and keep transport details in `actions/*`.
|
||||||
|
- You use translation keys heavily (good i18n discipline).
|
||||||
|
- You keep component files focused on one domain workflow.
|
||||||
|
|
||||||
|
## Your Answers (Captured)
|
||||||
|
|
||||||
|
### Go
|
||||||
|
- Error philosophy: undecided for now.
|
||||||
|
- Strict types over `any`: undecided for now.
|
||||||
|
- Authorization model: should be based on explicit permissions; admin role is a temporary service mechanism.
|
||||||
|
- Zero affected rows on update/delete: return `not_found` by default.
|
||||||
|
- SQL approach: keep inline raw SQL in this project.
|
||||||
|
|
||||||
|
### JSX / Next.js
|
||||||
|
- Component formatting: compact by default; multiline only when complexity justifies it.
|
||||||
|
- Mutation strategy today: optimistic updates currently used.
|
||||||
|
- Validation style: prefer schema-based validation over ad-hoc inline checks.
|
||||||
|
|
||||||
|
## Pending Clarifications
|
||||||
|
|
||||||
|
1. **Optimistic vs refetch default (Q7):**
|
||||||
|
Recommendation: keep optimistic update as default for snappy UX, and use refetch for high-risk operations (complex server-side side effects, computed fields, permission-dependent payloads).
|
||||||
|
|
||||||
|
2. **Display naming policy (Q8, clarified):**
|
||||||
|
Proposed rule: in UI, show user-facing label first (`name` or `description`) and fallback to `code` only when label is empty.
|
||||||
|
Please confirm if you want this as a global rule.
|
||||||
|
|
||||||
|
## Final Summary (Current)
|
||||||
|
|
||||||
|
### Confirmed style rules
|
||||||
|
- Go authorization should move toward explicit permissions, not role-only checks.
|
||||||
|
- Go repositories should return `not_found` for update/delete when `0 rows affected`.
|
||||||
|
- Go SQL stays inline/raw in this project.
|
||||||
|
- JSX/Next components should be compact by default; multiline formatting is allowed when readability needs it.
|
||||||
|
- Frontend validation direction is schema-first.
|
||||||
|
|
||||||
|
### Recommended defaults
|
||||||
|
- Mutation UX: optimistic updates by default; refetch only for risky mutations with possible server-side divergence.
|
||||||
|
- Action results: migrate from bare `{ success }` to richer result objects:
|
||||||
|
- success path: `{ success: true, data?: T }`
|
||||||
|
- error path: `{ success: false, errorCode: string, message?: string }`
|
||||||
|
|
||||||
|
### Still open
|
||||||
|
- Go error-wrapping strictness (`fmt.Errorf("...: %w", err)` everywhere vs selective).
|
||||||
|
- Strict ban of `any` in all service/repository boundaries.
|
||||||
|
- Global UI naming fallback rule (`name/description` first, `code` as fallback).
|
||||||
@@ -140,7 +140,7 @@ func (h *PositionsHandler) RemovePermissionFromPosition(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *PositionsHandler) ListPermissions(c *gin.Context) {
|
func (h *PositionsHandler) ListPermissions(c *gin.Context) {
|
||||||
perms, err := h.svc.GetAllPermissions(c.Request.Context())
|
perms, err := h.svc.GetAllPermissionsForLocale(c.Request.Context(), localeFromRequest(c))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Error(models.ErrInternal)
|
c.Error(models.ErrInternal)
|
||||||
return
|
return
|
||||||
@@ -149,6 +149,16 @@ func (h *PositionsHandler) ListPermissions(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, perms)
|
c.JSON(http.StatusOK, perms)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *PositionsHandler) ListUsersWithPositions(c *gin.Context) {
|
||||||
|
users, err := h.svc.GetUsersWithPositions(c.Request.Context(), localeFromRequest(c))
|
||||||
|
if err != nil {
|
||||||
|
c.Error(models.ErrInternal)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, users)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *PositionsHandler) AssignPosition(c *gin.Context) {
|
func (h *PositionsHandler) AssignPosition(c *gin.Context) {
|
||||||
adminID, ok := userIDFromContext(c)
|
adminID, ok := userIDFromContext(c)
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -201,7 +211,7 @@ func (h *PositionsHandler) CreatePermission(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := h.svc.CreatePermission(c.Request.Context(), req.Code, req.Description); err != nil {
|
if err := h.svc.CreatePermission(c.Request.Context(), req.Code, localeFromRequest(c), req.Description); err != nil {
|
||||||
c.Error(err)
|
c.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -218,7 +228,7 @@ func (h *PositionsHandler) UpdatePermission(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := h.svc.UpdatePermission(c.Request.Context(), c.Param("code"), req.Description); err != nil {
|
if err := h.svc.UpdatePermission(c.Request.Context(), c.Param("code"), localeFromRequest(c), req.Description); err != nil {
|
||||||
c.Error(err)
|
c.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,28 +58,95 @@ func NewRouter(
|
|||||||
me.DELETE("/consent/:clientId", authMiddleware(svc, repo, "profile:consent:delete"), consents.RevokeAppAccess)
|
me.DELETE("/consent/:clientId", authMiddleware(svc, repo, "profile:consent:delete"), consents.RevokeAppAccess)
|
||||||
me.GET("/positions", authMiddleware(svc, repo, "profile:read"), positions.GetMyPositions)
|
me.GET("/positions", authMiddleware(svc, repo, "profile:read"), positions.GetMyPositions)
|
||||||
|
|
||||||
admin := api.Group("/admin", authMiddleware(svc, repo), middleware.AdminOnly())
|
admin := api.Group("/admin", authMiddleware(svc, repo))
|
||||||
{
|
{
|
||||||
admin.GET("/permissions", positions.ListPermissions)
|
manage := admin.Group("", permissionMiddleware(svc, "positions.manage"))
|
||||||
admin.POST("/permissions", positions.CreatePermission)
|
{
|
||||||
admin.PUT("/permissions/:code", positions.UpdatePermission)
|
manage.GET("/permissions", positions.ListPermissions)
|
||||||
admin.DELETE("/permissions/:code", positions.DeletePermission)
|
manage.POST("/permissions", positions.CreatePermission)
|
||||||
|
manage.PUT("/permissions/:code", positions.UpdatePermission)
|
||||||
|
manage.DELETE("/permissions/:code", positions.DeletePermission)
|
||||||
|
|
||||||
admin.GET("/positions", positions.ListPositions)
|
manage.GET("/positions", positions.ListPositions)
|
||||||
admin.POST("/positions", positions.UpsertPosition)
|
manage.POST("/positions", positions.UpsertPosition)
|
||||||
admin.PUT("/positions/:code", positions.UpdatePosition)
|
manage.PUT("/positions/:code", positions.UpdatePosition)
|
||||||
admin.DELETE("/positions/:code", positions.DeletePosition)
|
manage.DELETE("/positions/:code", positions.DeletePosition)
|
||||||
admin.POST("/positions/:code/permissions", positions.AddPermissionToPosition)
|
manage.POST("/positions/:code/permissions", positions.AddPermissionToPosition)
|
||||||
admin.DELETE("/positions/:code/permissions/:permissionCode", positions.RemovePermissionFromPosition)
|
manage.DELETE("/positions/:code/permissions/:permissionCode", positions.RemovePermissionFromPosition)
|
||||||
|
}
|
||||||
|
|
||||||
admin.POST("/users/:userId/positions", positions.AssignPosition)
|
usersRead := admin.Group("", permissionAnyMiddleware(svc, "positions.assign", "positions.revoke"))
|
||||||
admin.DELETE("/users/:userId/positions/:code", positions.RevokePosition)
|
{
|
||||||
|
usersRead.GET("/users", positions.ListUsersWithPositions)
|
||||||
|
}
|
||||||
|
|
||||||
|
assign := admin.Group("", permissionMiddleware(svc, "positions.assign"))
|
||||||
|
{
|
||||||
|
assign.POST("/users/:userId/positions", positions.AssignPosition)
|
||||||
|
}
|
||||||
|
|
||||||
|
revoke := admin.Group("", permissionMiddleware(svc, "positions.revoke"))
|
||||||
|
{
|
||||||
|
revoke.DELETE("/users/:userId/positions/:code", positions.RevokePosition)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func permissionAnyMiddleware(svc *services.Service, requiredPermissions ...string) gin.HandlerFunc {
|
||||||
|
return func(c *gin.Context) {
|
||||||
|
userID, ok := UserIDFromContext(c)
|
||||||
|
if !ok {
|
||||||
|
c.Error(models.ErrUnauthorized)
|
||||||
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, permission := range requiredPermissions {
|
||||||
|
allowed, err := svc.UserHasPermission(c.Request.Context(), userID, permission)
|
||||||
|
if err != nil {
|
||||||
|
c.Error(models.ErrInternal)
|
||||||
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if allowed {
|
||||||
|
c.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Error(models.ErrForbidden.WithMessage("Missing required permissions"))
|
||||||
|
c.Abort()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func permissionMiddleware(svc *services.Service, requiredPermission string) gin.HandlerFunc {
|
||||||
|
return func(c *gin.Context) {
|
||||||
|
userID, ok := UserIDFromContext(c)
|
||||||
|
if !ok {
|
||||||
|
c.Error(models.ErrUnauthorized)
|
||||||
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
allowed, err := svc.UserHasPermission(c.Request.Context(), userID, requiredPermission)
|
||||||
|
if err != nil {
|
||||||
|
c.Error(models.ErrInternal)
|
||||||
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !allowed {
|
||||||
|
c.Error(models.ErrForbidden.WithMessage("Missing required permission: " + requiredPermission))
|
||||||
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Next()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func authMiddleware(svc *services.Service, repo *repositories.OAuthRepository, requiredScopes ...string) gin.HandlerFunc {
|
func authMiddleware(svc *services.Service, repo *repositories.OAuthRepository, requiredScopes ...string) gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
token, ok := bearerToken(c)
|
token, ok := bearerToken(c)
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type FieldType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
FieldTypeText FieldType = "text"
|
||||||
|
FieldTypeDate FieldType = "date"
|
||||||
|
FieldTypeSelect FieldType = "select"
|
||||||
|
FieldTypeMasked FieldType = "masked"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LocalizedString struct {
|
||||||
|
En string `json:"en"`
|
||||||
|
Ru string `json:"ru"`
|
||||||
|
It string `json:"it"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FieldOption struct {
|
||||||
|
Value string `json:"value"`
|
||||||
|
Label LocalizedString `json:"label"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FieldTemplate struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name LocalizedString `json:"name"`
|
||||||
|
Type FieldType `json:"type"`
|
||||||
|
Required bool `json:"required"`
|
||||||
|
Mask *string `json:"mask,omitempty"`
|
||||||
|
Options []FieldOption `json:"options,omitempty"`
|
||||||
|
Generated bool `json:"generated"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DocumentType struct {
|
||||||
|
ID uuid.UUID `db:"id" json:"id"`
|
||||||
|
Code string `db:"code" json:"code"`
|
||||||
|
EmblemURL string `db:"emblem_url" json:"emblem_url"`
|
||||||
|
Color string `db:"color" json:"color"`
|
||||||
|
Fields []FieldTemplate `db:"fields" json:"fields"`
|
||||||
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DocumentApplicationStatus string
|
||||||
|
|
||||||
|
const (
|
||||||
|
ApplicationStatusPending DocumentApplicationStatus = "pending"
|
||||||
|
ApplicationStatusApproved DocumentApplicationStatus = "approved"
|
||||||
|
ApplicationStatusRejected DocumentApplicationStatus = "rejected"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DocumentApplication struct {
|
||||||
|
ID uuid.UUID `db:"id" json:"id"`
|
||||||
|
UserID uuid.UUID `db:"user_id" json:"user_id"`
|
||||||
|
DocumentTypeID uuid.UUID `db:"document_type_id" json:"document_type_id"`
|
||||||
|
Status DocumentApplicationStatus `db:"status" json:"status"`
|
||||||
|
ReviewedBy *uuid.UUID `db:"reviewed_by" json:"reviewed_by,omitempty"`
|
||||||
|
ReviewedAt *time.Time `db:"reviewed_at" json:"reviewed_at,omitempty"`
|
||||||
|
RejectReason *string `db:"reject_reason" json:"reject_reason,omitempty"`
|
||||||
|
Data map[string]string `db:"data" json:"data"`
|
||||||
|
|
||||||
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||||
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DocumentApplicationLocalized struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
UserID uuid.UUID `json:"user_id"`
|
||||||
|
DocumentType DocumentType `json:"document_type"`
|
||||||
|
Status DocumentApplicationStatus `json:"status"`
|
||||||
|
ReviewedBy *uuid.UUID `json:"reviewed_by,omitempty"`
|
||||||
|
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
|
||||||
|
RejectReason *string `json:"reject_reason,omitempty"`
|
||||||
|
Data map[string]string `json:"data"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Document struct {
|
||||||
|
ID uuid.UUID `db:"id" json:"id"`
|
||||||
|
UserID uuid.UUID `db:"user_id" json:"user_id"`
|
||||||
|
DocumentTypeID uuid.UUID `db:"document_type_id" json:"document_type_id"`
|
||||||
|
ApplicationID uuid.UUID `db:"application_id" json:"application_id"`
|
||||||
|
Number string `db:"number" json:"number"`
|
||||||
|
PhotoURL *string `db:"photo_url" json:"photo_url,omitempty"`
|
||||||
|
Data map[string]string `db:"data" json:"data"`
|
||||||
|
IssuedAt time.Time `db:"issued_at" json:"issued_at"`
|
||||||
|
RevokedAt *time.Time `db:"revoked_at" json:"revoked_at,omitempty"`
|
||||||
|
RevokedBy *uuid.UUID `db:"revoked_by" json:"revoked_by,omitempty"`
|
||||||
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||||
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DocumentLocalized struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
UserID uuid.UUID `json:"user_id"`
|
||||||
|
DocumentType DocumentType `json:"document_type"`
|
||||||
|
ApplicationID uuid.UUID `json:"application_id"`
|
||||||
|
Number string `json:"number"`
|
||||||
|
PhotoURL *string `json:"photo_url,omitempty"`
|
||||||
|
Data map[string]string `json:"data"`
|
||||||
|
IssuedAt time.Time `json:"issued_at"`
|
||||||
|
RevokedAt *time.Time `json:"revoked_at,omitempty"`
|
||||||
|
RevokedBy *uuid.UUID `json:"revoked_by,omitempty"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateDocumentApplicationInput struct {
|
||||||
|
DocumentTypeCode string `json:"document_type_code" binding:"required"`
|
||||||
|
Data map[string]string `json:"data" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReviewDocumentApplicationInput struct {
|
||||||
|
Status DocumentApplicationStatus `json:"status" binding:"required"`
|
||||||
|
RejectReason *string `json:"reject_reason" binding:"omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RevokeDocumentInput struct {
|
||||||
|
DocumentID uuid.UUID `json:"document_id" binding:"required"`
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
type Permission struct {
|
type Permission struct {
|
||||||
ID uuid.UUID `db:"id" json:"id"`
|
ID uuid.UUID `db:"id" json:"id"`
|
||||||
Code string `db:"code" json:"code"`
|
Code string `db:"code" json:"code"`
|
||||||
|
Name string `db:"name" json:"name"`
|
||||||
Description string `db:"description" json:"description"`
|
Description string `db:"description" json:"description"`
|
||||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Region struct {
|
||||||
|
ID uuid.UUID `db:"id" json:"id"`
|
||||||
|
Code string `db:"code" json:"code"`
|
||||||
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegionTranslation struct {
|
||||||
|
RegionID uuid.UUID `db:"region_id" json:"region_id"`
|
||||||
|
Locale string `db:"locale" json:"locale"`
|
||||||
|
Name string `db:"name" json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegionLocalized struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
@@ -19,6 +19,15 @@ type User struct {
|
|||||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UserWithPositions struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
FirstName string `json:"first_name"`
|
||||||
|
SecondName string `json:"second_name"`
|
||||||
|
IsAdmin bool `json:"is_admin"`
|
||||||
|
Positions []PositionLocalized `json:"positions"`
|
||||||
|
}
|
||||||
|
|
||||||
type UserRegisterInput struct {
|
type UserRegisterInput struct {
|
||||||
Email string `json:"email" binding:"required,min=3"`
|
Email string `json:"email" binding:"required,min=3"`
|
||||||
Password string `json:"password" binding:"required,min=8"`
|
Password string `json:"password" binding:"required,min=8"`
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package repositories
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/dusiburg/kotosoft-id/internal/models"
|
"github.com/dusiburg/kotosoft-id/internal/models"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@@ -17,12 +18,20 @@ func NewPositionRepository(db *pgxpool.Pool) *PositionRepository {
|
|||||||
return &PositionRepository{db: db}
|
return &PositionRepository{db: db}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) GetAllPermissions(ctx context.Context) ([]models.Permission, error) {
|
func (r *PositionRepository) GetAllPermissions(ctx context.Context, locale string) ([]models.Permission, error) {
|
||||||
rows, err := r.db.Query(ctx, `
|
rows, err := r.db.Query(ctx, `
|
||||||
SELECT id, code, COALESCE(description, ''), created_at
|
SELECT p.id,
|
||||||
FROM permissions
|
p.code,
|
||||||
|
COALESCE(pl.name, pe.name, p.code) AS name,
|
||||||
|
COALESCE(pl.description, pe.description, p.description, '') AS description,
|
||||||
|
p.created_at
|
||||||
|
FROM permissions p
|
||||||
|
LEFT JOIN permission_translations pl
|
||||||
|
ON pl.permission_id = p.id AND pl.locale = $1
|
||||||
|
LEFT JOIN permission_translations pe
|
||||||
|
ON pe.permission_id = p.id AND pe.locale = 'en'
|
||||||
ORDER BY code
|
ORDER BY code
|
||||||
`)
|
`, strings.ToLower(locale))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -31,7 +40,7 @@ func (r *PositionRepository) GetAllPermissions(ctx context.Context) ([]models.Pe
|
|||||||
var result []models.Permission
|
var result []models.Permission
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var p models.Permission
|
var p models.Permission
|
||||||
if err := rows.Scan(&p.ID, &p.Code, &p.Description, &p.CreatedAt); err != nil {
|
if err := rows.Scan(&p.ID, &p.Code, &p.Name, &p.Description, &p.CreatedAt); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result = append(result, p)
|
result = append(result, p)
|
||||||
@@ -39,25 +48,77 @@ func (r *PositionRepository) GetAllPermissions(ctx context.Context) ([]models.Pe
|
|||||||
return result, rows.Err()
|
return result, rows.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) CreatePermission(ctx context.Context, code string, description *string) error {
|
func (r *PositionRepository) CreatePermission(ctx context.Context, code, locale string, description *string) error {
|
||||||
_, err := r.db.Exec(ctx, `
|
tx, err := r.db.Begin(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer tx.Rollback(ctx)
|
||||||
|
|
||||||
|
var permissionID uuid.UUID
|
||||||
|
err = tx.QueryRow(ctx, `
|
||||||
INSERT INTO permissions (code, description)
|
INSERT INTO permissions (code, description)
|
||||||
VALUES ($1, $2)
|
VALUES ($1, $2)
|
||||||
`, code, description)
|
RETURNING id
|
||||||
|
`, code, description).Scan(&permissionID)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) UpdatePermission(ctx context.Context, code string, description *string) error {
|
_, err = tx.Exec(ctx, `
|
||||||
_, err := r.db.Exec(ctx, `
|
INSERT INTO permission_translations (permission_id, locale, name, description)
|
||||||
UPDATE permissions SET description = $2 WHERE code = $1
|
VALUES ($1, $2, $3, $4)
|
||||||
`, code, description)
|
ON CONFLICT (permission_id, locale) DO UPDATE
|
||||||
|
SET name = EXCLUDED.name, description = EXCLUDED.description
|
||||||
|
`, permissionID, strings.ToLower(locale), code, description)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return tx.Commit(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *PositionRepository) UpdatePermission(ctx context.Context, code, locale string, description *string) error {
|
||||||
|
tx, err := r.db.Begin(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer tx.Rollback(ctx)
|
||||||
|
|
||||||
|
var permissionID uuid.UUID
|
||||||
|
err = tx.QueryRow(ctx, `
|
||||||
|
UPDATE permissions
|
||||||
|
SET description = $2
|
||||||
|
WHERE code = $1
|
||||||
|
RETURNING id
|
||||||
|
`, code, description).Scan(&permissionID)
|
||||||
|
if err != nil {
|
||||||
|
return models.ErrNotFound
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = tx.Exec(ctx, `
|
||||||
|
INSERT INTO permission_translations (permission_id, locale, name, description)
|
||||||
|
VALUES ($1, $2, $3, $4)
|
||||||
|
ON CONFLICT (permission_id, locale) DO UPDATE
|
||||||
|
SET name = EXCLUDED.name, description = EXCLUDED.description
|
||||||
|
`, permissionID, strings.ToLower(locale), code, description)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return tx.Commit(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) DeletePermission(ctx context.Context, code string) error {
|
func (r *PositionRepository) DeletePermission(ctx context.Context, code string) error {
|
||||||
_, err := r.db.Exec(ctx, `DELETE FROM permissions WHERE code = $1`, code)
|
tag, err := r.db.Exec(ctx, `DELETE FROM permissions WHERE code = $1`, code)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if tag.RowsAffected() == 0 {
|
||||||
|
return models.ErrNotFound
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) GetPermissionByCode(ctx context.Context, code string) (*models.Permission, error) {
|
func (r *PositionRepository) GetPermissionByCode(ctx context.Context, code string) (*models.Permission, error) {
|
||||||
var p models.Permission
|
var p models.Permission
|
||||||
@@ -71,14 +132,22 @@ func (r *PositionRepository) GetPermissionByCode(ctx context.Context, code strin
|
|||||||
return &p, nil
|
return &p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) GetPositionPermissions(ctx context.Context, positionID uuid.UUID) ([]models.Permission, error) {
|
func (r *PositionRepository) GetPositionPermissions(ctx context.Context, positionID uuid.UUID, locale string) ([]models.Permission, error) {
|
||||||
rows, err := r.db.Query(ctx, `
|
rows, err := r.db.Query(ctx, `
|
||||||
SELECT p.id, p.code, COALESCE(p.description, ''), p.created_at
|
SELECT p.id,
|
||||||
|
p.code,
|
||||||
|
COALESCE(pl.name, pe.name, p.code) AS name,
|
||||||
|
COALESCE(pl.description, pe.description, p.description, '') AS description,
|
||||||
|
p.created_at
|
||||||
FROM position_permissions pp
|
FROM position_permissions pp
|
||||||
JOIN permissions p ON pp.permission_id = p.id
|
JOIN permissions p ON pp.permission_id = p.id
|
||||||
|
LEFT JOIN permission_translations pl
|
||||||
|
ON pl.permission_id = p.id AND pl.locale = $2
|
||||||
|
LEFT JOIN permission_translations pe
|
||||||
|
ON pe.permission_id = p.id AND pe.locale = 'en'
|
||||||
WHERE pp.position_id = $1
|
WHERE pp.position_id = $1
|
||||||
ORDER BY p.code
|
ORDER BY p.code
|
||||||
`, positionID)
|
`, positionID, strings.ToLower(locale))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -87,7 +156,7 @@ func (r *PositionRepository) GetPositionPermissions(ctx context.Context, positio
|
|||||||
var result []models.Permission
|
var result []models.Permission
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var p models.Permission
|
var p models.Permission
|
||||||
if err := rows.Scan(&p.ID, &p.Code, &p.Description, &p.CreatedAt); err != nil {
|
if err := rows.Scan(&p.ID, &p.Code, &p.Name, &p.Description, &p.CreatedAt); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result = append(result, p)
|
result = append(result, p)
|
||||||
@@ -149,7 +218,7 @@ func (r *PositionRepository) GetUserPositions(ctx context.Context, userID uuid.U
|
|||||||
if err := rows.Scan(&positionID, &p.Code, &p.Name, &p.Description); err != nil {
|
if err := rows.Scan(&positionID, &p.Code, &p.Name, &p.Description); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
perms, err := r.GetPositionPermissions(ctx, positionID)
|
perms, err := r.GetPositionPermissions(ctx, positionID, locale)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -184,7 +253,7 @@ func (r *PositionRepository) GetAllPositions(ctx context.Context, locale string)
|
|||||||
if err := rows.Scan(&positionID, &p.Code, &p.Name, &p.Description); err != nil {
|
if err := rows.Scan(&positionID, &p.Code, &p.Name, &p.Description); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
perms, err := r.GetPositionPermissions(ctx, positionID)
|
perms, err := r.GetPositionPermissions(ctx, positionID, locale)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -197,6 +266,39 @@ func (r *PositionRepository) GetAllPositions(ctx context.Context, locale string)
|
|||||||
return result, rows.Err()
|
return result, rows.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *PositionRepository) GetUsersWithPositions(ctx context.Context, locale string) ([]models.UserWithPositions, error) {
|
||||||
|
rows, err := r.db.Query(ctx, `
|
||||||
|
SELECT id, email, first_name, second_name, is_admin
|
||||||
|
FROM users
|
||||||
|
ORDER BY first_name, second_name, email
|
||||||
|
`)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
var result []models.UserWithPositions
|
||||||
|
for rows.Next() {
|
||||||
|
var u models.UserWithPositions
|
||||||
|
if err := rows.Scan(&u.ID, &u.Email, &u.FirstName, &u.SecondName, &u.IsAdmin); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
positions, err := r.GetUserPositions(ctx, u.ID, locale)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if positions == nil {
|
||||||
|
positions = []models.PositionLocalized{}
|
||||||
|
}
|
||||||
|
u.Positions = positions
|
||||||
|
|
||||||
|
result = append(result, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, rows.Err()
|
||||||
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) UpsertPositionForLocale(ctx context.Context, code, locale, name string, description *string) error {
|
func (r *PositionRepository) UpsertPositionForLocale(ctx context.Context, code, locale, name string, description *string) error {
|
||||||
tx, err := r.db.Begin(ctx)
|
tx, err := r.db.Begin(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -233,7 +335,7 @@ func (r *PositionRepository) DeletePositionByCode(ctx context.Context, code stri
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) AssignPosition(ctx context.Context, userID, positionID uuid.UUID, assignedBy *uuid.UUID, validFrom interface{}, validTo *interface{}) error {
|
func (r *PositionRepository) AssignPosition(ctx context.Context, userID, positionID uuid.UUID, assignedBy *uuid.UUID, validFrom time.Time, validTo *time.Time) error {
|
||||||
_, err := r.db.Exec(ctx, `
|
_, err := r.db.Exec(ctx, `
|
||||||
INSERT INTO user_positions (user_id, position_id, assigned_by, valid_from, valid_to)
|
INSERT INTO user_positions (user_id, position_id, assigned_by, valid_from, valid_to)
|
||||||
VALUES ($1, $2, $3, COALESCE($4, now()), $5)
|
VALUES ($1, $2, $3, COALESCE($4, now()), $5)
|
||||||
@@ -271,16 +373,24 @@ func (r *PositionRepository) UserHasPermission(ctx context.Context, userID uuid.
|
|||||||
return true, positionCode, nil
|
return true, positionCode, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PositionRepository) GetUserPermissions(ctx context.Context, userID uuid.UUID) ([]models.Permission, error) {
|
func (r *PositionRepository) GetUserPermissions(ctx context.Context, userID uuid.UUID, locale string) ([]models.Permission, error) {
|
||||||
rows, err := r.db.Query(ctx, `
|
rows, err := r.db.Query(ctx, `
|
||||||
SELECT DISTINCT perm.id, perm.code, COALESCE(perm.description, ''), perm.created_at
|
SELECT DISTINCT perm.id,
|
||||||
|
perm.code,
|
||||||
|
COALESCE(pl.name, pe.name, perm.code) AS name,
|
||||||
|
COALESCE(pl.description, pe.description, perm.description, '') AS description,
|
||||||
|
perm.created_at
|
||||||
FROM user_positions up
|
FROM user_positions up
|
||||||
JOIN position_permissions pp ON pp.position_id = up.position_id
|
JOIN position_permissions pp ON pp.position_id = up.position_id
|
||||||
JOIN permissions perm ON pp.permission_id = perm.id
|
JOIN permissions perm ON pp.permission_id = perm.id
|
||||||
|
LEFT JOIN permission_translations pl
|
||||||
|
ON pl.permission_id = perm.id AND pl.locale = $2
|
||||||
|
LEFT JOIN permission_translations pe
|
||||||
|
ON pe.permission_id = perm.id AND pe.locale = 'en'
|
||||||
WHERE up.user_id = $1
|
WHERE up.user_id = $1
|
||||||
AND (up.valid_to IS NULL OR up.valid_to > now())
|
AND (up.valid_to IS NULL OR up.valid_to > now())
|
||||||
ORDER BY perm.code
|
ORDER BY perm.code
|
||||||
`, userID)
|
`, userID, strings.ToLower(locale))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -289,7 +399,7 @@ func (r *PositionRepository) GetUserPermissions(ctx context.Context, userID uuid
|
|||||||
var result []models.Permission
|
var result []models.Permission
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var p models.Permission
|
var p models.Permission
|
||||||
if err := rows.Scan(&p.ID, &p.Code, &p.Description, &p.CreatedAt); err != nil {
|
if err := rows.Scan(&p.ID, &p.Code, &p.Name, &p.Description, &p.CreatedAt); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result = append(result, p)
|
result = append(result, p)
|
||||||
|
|||||||
@@ -95,3 +95,11 @@ func (r *UserRepository) GetUserByID(ctx context.Context, id uuid.UUID) (*models
|
|||||||
}
|
}
|
||||||
return &u, nil
|
return &u, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *UserRepository) CountUsers(ctx context.Context) (int, error) {
|
||||||
|
var count int
|
||||||
|
if err := r.db.QueryRow(ctx, `SELECT COUNT(*) FROM users`).Scan(&count); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return count, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func (s *Service) Register(ctx context.Context, input models.UserRegisterInput)
|
|||||||
return nil, models.ErrInternal
|
return nil, models.ErrInternal
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.users.CreateUser(ctx, models.User{
|
user, err := s.users.CreateUser(ctx, models.User{
|
||||||
Email: input.Email,
|
Email: input.Email,
|
||||||
PasswordHash: string(hash),
|
PasswordHash: string(hash),
|
||||||
FirstName: input.FirstName,
|
FirstName: input.FirstName,
|
||||||
@@ -39,6 +39,23 @@ func (s *Service) Register(ctx context.Context, input models.UserRegisterInput)
|
|||||||
BirthDate: input.BirthDate,
|
BirthDate: input.BirthDate,
|
||||||
Sex: input.Sex,
|
Sex: input.Sex,
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
count, err := s.users.CountUsers(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, models.ErrInternal
|
||||||
|
}
|
||||||
|
if count == 1 {
|
||||||
|
position, err := s.positions.GetPositionByCode(ctx, "kotosoft_id_staff")
|
||||||
|
if err == nil {
|
||||||
|
now := time.Now()
|
||||||
|
_ = s.positions.AssignPosition(ctx, user.ID, position.ID, nil, now, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) ValidateAccessToken(ctx context.Context, token string) (*TokenInfo, error) {
|
func (s *Service) ValidateAccessToken(ctx context.Context, token string) (*TokenInfo, error) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *Service) GetAllPermissions(ctx context.Context) ([]models.Permission, error) {
|
func (s *Service) GetAllPermissions(ctx context.Context) ([]models.Permission, error) {
|
||||||
return s.positions.GetAllPermissions(ctx)
|
return s.positions.GetAllPermissions(ctx, "en")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) AddPermissionToPosition(ctx context.Context, positionCode, permissionCode string) error {
|
func (s *Service) AddPermissionToPosition(ctx context.Context, positionCode, permissionCode string) error {
|
||||||
@@ -54,6 +54,13 @@ func (s *Service) GetAllPositions(ctx context.Context, locale string) ([]models.
|
|||||||
return s.positions.GetAllPositions(ctx, locale)
|
return s.positions.GetAllPositions(ctx, locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) GetUsersWithPositions(ctx context.Context, locale string) ([]models.UserWithPositions, error) {
|
||||||
|
if locale == "" {
|
||||||
|
locale = "en"
|
||||||
|
}
|
||||||
|
return s.positions.GetUsersWithPositions(ctx, locale)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) UpsertPositionForLocale(ctx context.Context, code, locale, name string, description *string) error {
|
func (s *Service) UpsertPositionForLocale(ctx context.Context, code, locale, name string, description *string) error {
|
||||||
if locale == "" {
|
if locale == "" {
|
||||||
locale = "en"
|
locale = "en"
|
||||||
@@ -76,7 +83,7 @@ func (s *Service) AssignPosition(ctx context.Context, adminID, targetUserID uuid
|
|||||||
validFrom = time.Now()
|
validFrom = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.positions.AssignPosition(ctx, targetUserID, position.ID, &adminID, validFrom, (*interface{})(nil))
|
return s.positions.AssignPosition(ctx, targetUserID, position.ID, &adminID, validFrom, input.ValidTo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) RevokePosition(ctx context.Context, targetUserID uuid.UUID, positionCode string) error {
|
func (s *Service) RevokePosition(ctx context.Context, targetUserID uuid.UUID, positionCode string) error {
|
||||||
@@ -85,15 +92,32 @@ func (s *Service) RevokePosition(ctx context.Context, targetUserID uuid.UUID, po
|
|||||||
return models.ErrNotFound
|
return models.ErrNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if position.Code == "kotosoft_id_staff" {
|
||||||
|
return models.ErrForbidden
|
||||||
|
}
|
||||||
|
|
||||||
return s.positions.RevokePosition(ctx, targetUserID, position.ID)
|
return s.positions.RevokePosition(ctx, targetUserID, position.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) CreatePermission(ctx context.Context, code string, description *string) error {
|
func (s *Service) GetAllPermissionsForLocale(ctx context.Context, locale string) ([]models.Permission, error) {
|
||||||
return s.positions.CreatePermission(ctx, code, description)
|
if locale == "" {
|
||||||
|
locale = "en"
|
||||||
|
}
|
||||||
|
return s.positions.GetAllPermissions(ctx, locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) UpdatePermission(ctx context.Context, code string, description *string) error {
|
func (s *Service) CreatePermission(ctx context.Context, code, locale string, description *string) error {
|
||||||
return s.positions.UpdatePermission(ctx, code, description)
|
if locale == "" {
|
||||||
|
locale = "en"
|
||||||
|
}
|
||||||
|
return s.positions.CreatePermission(ctx, code, locale, description)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) UpdatePermission(ctx context.Context, code, locale string, description *string) error {
|
||||||
|
if locale == "" {
|
||||||
|
locale = "en"
|
||||||
|
}
|
||||||
|
return s.positions.UpdatePermission(ctx, code, locale, description)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) DeletePermission(ctx context.Context, code string) error {
|
func (s *Service) DeletePermission(ctx context.Context, code string) error {
|
||||||
@@ -132,7 +156,7 @@ func (s *Service) IntrospectToken(ctx context.Context, token string) (*Introspec
|
|||||||
positions = []models.PositionLocalized{}
|
positions = []models.PositionLocalized{}
|
||||||
}
|
}
|
||||||
|
|
||||||
allPerms, err := s.positions.GetUserPermissions(ctx, user.ID)
|
allPerms, err := s.positions.GetUserPermissions(ctx, user.ID, "en")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &IntrospectResponse{Active: false}, nil
|
return &IntrospectResponse{Active: false}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ type UserRepo interface {
|
|||||||
GetUserByEmail(ctx context.Context, email string) (*models.User, error)
|
GetUserByEmail(ctx context.Context, email string) (*models.User, error)
|
||||||
GetUserByID(ctx context.Context, id uuid.UUID) (*models.User, error)
|
GetUserByID(ctx context.Context, id uuid.UUID) (*models.User, error)
|
||||||
IsUserExistsByEmail(ctx context.Context, email string) bool
|
IsUserExistsByEmail(ctx context.Context, email string) bool
|
||||||
|
CountUsers(ctx context.Context) (int, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type OAuthRepo interface {
|
type OAuthRepo interface {
|
||||||
@@ -47,25 +48,26 @@ type OAuthRepo interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PositionRepo interface {
|
type PositionRepo interface {
|
||||||
GetAllPermissions(ctx context.Context) ([]models.Permission, error)
|
GetAllPermissions(ctx context.Context, locale string) ([]models.Permission, error)
|
||||||
GetPermissionByCode(ctx context.Context, code string) (*models.Permission, error)
|
GetPermissionByCode(ctx context.Context, code string) (*models.Permission, error)
|
||||||
GetPositionPermissions(ctx context.Context, positionID uuid.UUID) ([]models.Permission, error)
|
GetPositionPermissions(ctx context.Context, positionID uuid.UUID, locale string) ([]models.Permission, error)
|
||||||
AddPermissionToPosition(ctx context.Context, positionID, permissionID uuid.UUID) error
|
AddPermissionToPosition(ctx context.Context, positionID, permissionID uuid.UUID) error
|
||||||
RemovePermissionFromPosition(ctx context.Context, positionID, permissionID uuid.UUID) error
|
RemovePermissionFromPosition(ctx context.Context, positionID, permissionID uuid.UUID) error
|
||||||
|
|
||||||
GetPositionByCode(ctx context.Context, code string) (*models.Position, error)
|
GetPositionByCode(ctx context.Context, code string) (*models.Position, error)
|
||||||
GetUserPositions(ctx context.Context, userID uuid.UUID, locale string) ([]models.PositionLocalized, error)
|
GetUserPositions(ctx context.Context, userID uuid.UUID, locale string) ([]models.PositionLocalized, error)
|
||||||
GetAllPositions(ctx context.Context, locale string) ([]models.PositionLocalized, error)
|
GetAllPositions(ctx context.Context, locale string) ([]models.PositionLocalized, error)
|
||||||
|
GetUsersWithPositions(ctx context.Context, locale string) ([]models.UserWithPositions, error)
|
||||||
UpsertPositionForLocale(ctx context.Context, code, locale, name string, description *string) error
|
UpsertPositionForLocale(ctx context.Context, code, locale, name string, description *string) error
|
||||||
|
|
||||||
AssignPosition(ctx context.Context, userID, positionID uuid.UUID, assignedBy *uuid.UUID, validFrom any, validTo *any) error
|
AssignPosition(ctx context.Context, userID, positionID uuid.UUID, assignedBy *uuid.UUID, validFrom time.Time, validTo *time.Time) error
|
||||||
RevokePosition(ctx context.Context, userID, positionID uuid.UUID) error
|
RevokePosition(ctx context.Context, userID, positionID uuid.UUID) error
|
||||||
|
|
||||||
UserHasPermission(ctx context.Context, userID uuid.UUID, permissionCode string) (bool, string, error)
|
UserHasPermission(ctx context.Context, userID uuid.UUID, permissionCode string) (bool, string, error)
|
||||||
GetUserPermissions(ctx context.Context, userID uuid.UUID) ([]models.Permission, error)
|
GetUserPermissions(ctx context.Context, userID uuid.UUID, locale string) ([]models.Permission, error)
|
||||||
|
|
||||||
CreatePermission(ctx context.Context, code string, description *string) error
|
CreatePermission(ctx context.Context, code, locale string, description *string) error
|
||||||
UpdatePermission(ctx context.Context, code string, description *string) error
|
UpdatePermission(ctx context.Context, code, locale string, description *string) error
|
||||||
DeletePositionByCode(ctx context.Context, code string) error
|
DeletePositionByCode(ctx context.Context, code string) error
|
||||||
DeletePermission(ctx context.Context, code string) error
|
DeletePermission(ctx context.Context, code string) error
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -132,11 +132,95 @@ CREATE TABLE IF NOT EXISTS public.permissions (
|
|||||||
created_at timestamptz NOT NULL DEFAULT now()
|
created_at timestamptz NOT NULL DEFAULT now()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS public.permission_translations (
|
||||||
|
permission_id uuid NOT NULL REFERENCES public.permissions(id) ON DELETE CASCADE,
|
||||||
|
locale text NOT NULL DEFAULT 'en',
|
||||||
|
name text NOT NULL,
|
||||||
|
description text,
|
||||||
|
PRIMARY KEY (permission_id, locale)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_permission_translations_permission_id
|
||||||
|
ON public.permission_translations (permission_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_permission_translations_locale
|
||||||
|
ON public.permission_translations (locale);
|
||||||
|
|
||||||
INSERT INTO public.permissions (code, description) VALUES
|
INSERT INTO public.permissions (code, description) VALUES
|
||||||
('positions.manage', 'Create and edit positions'),
|
('positions.manage', 'Create and edit positions'),
|
||||||
('positions.assign', 'Assign positions to users')
|
('positions.assign', 'Assign positions to users'),
|
||||||
|
('positions.revoke', 'Revoke positions from users')
|
||||||
ON CONFLICT (code) DO NOTHING;
|
ON CONFLICT (code) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO public.permission_translations (permission_id, locale, name, description)
|
||||||
|
SELECT id, 'en', code, description FROM public.permissions
|
||||||
|
ON CONFLICT (permission_id, locale) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO public.permission_translations (permission_id, locale, name, description)
|
||||||
|
SELECT id,
|
||||||
|
'ru',
|
||||||
|
CASE code
|
||||||
|
WHEN 'positions.manage' THEN 'Управление должностями'
|
||||||
|
WHEN 'positions.assign' THEN 'Назначение должностей'
|
||||||
|
WHEN 'positions.revoke' THEN 'Отзыв должностей'
|
||||||
|
ELSE code
|
||||||
|
END,
|
||||||
|
CASE code
|
||||||
|
WHEN 'positions.manage' THEN 'Создание и редактирование должностей'
|
||||||
|
WHEN 'positions.assign' THEN 'Назначение должностей пользователям'
|
||||||
|
WHEN 'positions.revoke' THEN 'Отзыв должностей у пользователей'
|
||||||
|
ELSE description
|
||||||
|
END
|
||||||
|
FROM public.permissions
|
||||||
|
ON CONFLICT (permission_id, locale) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO public.permission_translations (permission_id, locale, name, description)
|
||||||
|
SELECT id,
|
||||||
|
'it',
|
||||||
|
CASE code
|
||||||
|
WHEN 'positions.manage' THEN 'Gestione posizioni'
|
||||||
|
WHEN 'positions.assign' THEN 'Assegnazione posizioni'
|
||||||
|
WHEN 'positions.revoke' THEN 'Revoca posizioni'
|
||||||
|
ELSE code
|
||||||
|
END,
|
||||||
|
CASE code
|
||||||
|
WHEN 'positions.manage' THEN 'Creazione e modifica delle posizioni'
|
||||||
|
WHEN 'positions.assign' THEN 'Assegnazione delle posizioni agli utenti'
|
||||||
|
WHEN 'positions.revoke' THEN 'Revoca delle posizioni dagli utenti'
|
||||||
|
ELSE description
|
||||||
|
END
|
||||||
|
FROM public.permissions
|
||||||
|
ON CONFLICT (permission_id, locale) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO public.positions (code)
|
||||||
|
VALUES ('kotosoft_id_staff')
|
||||||
|
ON CONFLICT (code) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO public.position_translations (position_id, locale, name, description)
|
||||||
|
SELECT id, 'en', 'Kotosoft ID Staff', 'Default staff position for Kotosoft ID operators'
|
||||||
|
FROM public.positions
|
||||||
|
WHERE code = 'kotosoft_id_staff'
|
||||||
|
ON CONFLICT (position_id, locale) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO public.position_translations (position_id, locale, name, description)
|
||||||
|
SELECT id, 'ru', 'Сотрудник Kotosoft ID', 'Базовая должность сотрудника Kotosoft ID'
|
||||||
|
FROM public.positions
|
||||||
|
WHERE code = 'kotosoft_id_staff'
|
||||||
|
ON CONFLICT (position_id, locale) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO public.position_translations (position_id, locale, name, description)
|
||||||
|
SELECT id, 'it', 'Operatore Kotosoft ID', 'Posizione predefinita per operatori Kotosoft ID'
|
||||||
|
FROM public.positions
|
||||||
|
WHERE code = 'kotosoft_id_staff'
|
||||||
|
ON CONFLICT (position_id, locale) DO NOTHING;
|
||||||
|
|
||||||
|
INSERT INTO public.position_permissions (position_id, permission_id)
|
||||||
|
SELECT p.id, perm.id
|
||||||
|
FROM public.positions p
|
||||||
|
JOIN public.permissions perm ON perm.code IN ('positions.manage', 'positions.assign', 'positions.revoke')
|
||||||
|
WHERE p.code = 'kotosoft_id_staff'
|
||||||
|
ON CONFLICT (position_id, permission_id) DO NOTHING;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS public.position_permissions (
|
CREATE TABLE IF NOT EXISTS public.position_permissions (
|
||||||
position_id uuid NOT NULL REFERENCES public.positions(id) ON DELETE CASCADE,
|
position_id uuid NOT NULL REFERENCES public.positions(id) ON DELETE CASCADE,
|
||||||
permission_id uuid NOT NULL REFERENCES public.permissions(id) ON DELETE CASCADE,
|
permission_id uuid NOT NULL REFERENCES public.permissions(id) ON DELETE CASCADE,
|
||||||
@@ -200,3 +284,19 @@ CREATE TRIGGER positions_updated_at
|
|||||||
BEFORE UPDATE ON public.positions
|
BEFORE UPDATE ON public.positions
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
EXECUTE FUNCTION public.set_updated_at();
|
EXECUTE FUNCTION public.set_updated_at();
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS public.regions (
|
||||||
|
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
code char(2) NOT NULL UNIQUE,
|
||||||
|
created_at timestamptz NOT NULL DEFAULT now()
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS public.region_translations (
|
||||||
|
region_id uuid NOT NULL REFERENCES public.regions(id) ON DELETE CASCADE,
|
||||||
|
locale text NOT NULL,
|
||||||
|
name text NOT NULL,
|
||||||
|
PRIMARY KEY (region_id, locale)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_region_translations_region_id
|
||||||
|
ON public.region_translations (region_id);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
"use server"
|
"use server"
|
||||||
|
|
||||||
import type { Permission, Position } from "@/types"
|
import type { AdminUser, Permission, Position } from "@/types"
|
||||||
import { cookies } from "next/headers"
|
import { cookies } from "next/headers"
|
||||||
|
|
||||||
async function getAccessToken(): Promise<string | null> {
|
async function getAccessToken(): Promise<string | null> {
|
||||||
@@ -70,38 +70,51 @@ export async function savePosition(
|
|||||||
return handleSuccessResponse(res)
|
return handleSuccessResponse(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchAllPermissions(): Promise<Permission[]> {
|
export async function fetchAllPermissions(locale?: string): Promise<Permission[]> {
|
||||||
const token = await getAccessToken()
|
const token = await getAccessToken()
|
||||||
if (!token) return []
|
if (!token) return []
|
||||||
|
|
||||||
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/permissions`, {
|
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/permissions`, {
|
||||||
headers: await getAuthHeaders(),
|
headers: await getAuthHeaders(locale),
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
})
|
})
|
||||||
|
|
||||||
return (await handleJsonResponse<Permission[]>(res)) ?? []
|
return (await handleJsonResponse<Permission[]>(res)) ?? []
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addPermission(code: string, description?: string): Promise<{ success: boolean }> {
|
export async function fetchAdminUsers(locale?: string): Promise<AdminUser[] | null> {
|
||||||
|
const token = await getAccessToken()
|
||||||
|
if (!token) return null
|
||||||
|
|
||||||
|
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/users`, {
|
||||||
|
headers: await getAuthHeaders(locale),
|
||||||
|
cache: "no-store",
|
||||||
|
})
|
||||||
|
|
||||||
|
if (res.status === 403) return []
|
||||||
|
return await handleJsonResponse<AdminUser[]>(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function addPermission(code: string, description?: string, locale?: string): Promise<{ success: boolean }> {
|
||||||
const token = await getAccessToken()
|
const token = await getAccessToken()
|
||||||
if (!token) return { success: false }
|
if (!token) return { success: false }
|
||||||
|
|
||||||
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/permissions`, {
|
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/permissions`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { ...(await getAuthHeaders()), "Content-Type": "application/json" },
|
headers: { ...(await getAuthHeaders(locale)), "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ code, ...(description ? { description } : {}) }),
|
body: JSON.stringify({ code, ...(description ? { description } : {}) }),
|
||||||
})
|
})
|
||||||
|
|
||||||
return handleSuccessResponse(res)
|
return handleSuccessResponse(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function editPermission(code: string, description?: string): Promise<{ success: boolean }> {
|
export async function editPermission(code: string, description?: string, locale?: string): Promise<{ success: boolean }> {
|
||||||
const token = await getAccessToken()
|
const token = await getAccessToken()
|
||||||
if (!token) return { success: false }
|
if (!token) return { success: false }
|
||||||
|
|
||||||
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/permissions/${code}`, {
|
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/permissions/${code}`, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: { ...(await getAuthHeaders()), "Content-Type": "application/json" },
|
headers: { ...(await getAuthHeaders(locale)), "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ ...(description ? { description } : {}) }),
|
body: JSON.stringify({ ...(description ? { description } : {}) }),
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -120,6 +133,29 @@ export async function removePermission(code: string): Promise<{ success: boolean
|
|||||||
return handleSuccessResponse(res)
|
return handleSuccessResponse(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function diffPermissions(oldP: string[], newP: string[]) {
|
||||||
|
const oldSet = new Set(oldP)
|
||||||
|
const newSet = new Set(newP)
|
||||||
|
|
||||||
|
const toAdd = newP.filter(p => !oldSet.has(p))
|
||||||
|
const toRemove = oldP.filter(p => !newSet.has(p))
|
||||||
|
|
||||||
|
return { toAdd, toRemove }
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function syncPositionPermissions(
|
||||||
|
positionCode: string,
|
||||||
|
oldPermissions: string[],
|
||||||
|
newPermissions: string[]
|
||||||
|
) {
|
||||||
|
const { toAdd, toRemove } = diffPermissions(oldPermissions, newPermissions)
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
...toAdd.map(p => attachPermissionToPosition(positionCode, p)),
|
||||||
|
...toRemove.map(p => detachPermissionFromPosition(positionCode, p)),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
export async function attachPermissionToPosition(
|
export async function attachPermissionToPosition(
|
||||||
positionCode: string,
|
positionCode: string,
|
||||||
permissionCode: string
|
permissionCode: string
|
||||||
@@ -191,26 +227,26 @@ export async function revokePositionFromUser(userId: string, positionCode: strin
|
|||||||
return handleSuccessResponse(res)
|
return handleSuccessResponse(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addPosition(code: string, name: string, description?: string): Promise<{ success: boolean }> {
|
export async function addPosition(code: string, name: string, description?: string, locale?: string): Promise<{ success: boolean }> {
|
||||||
const token = await getAccessToken()
|
const token = await getAccessToken()
|
||||||
if (!token) return { success: false }
|
if (!token) return { success: false }
|
||||||
|
|
||||||
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/positions`, {
|
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/positions`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { ...(await getAuthHeaders()), "Content-Type": "application/json" },
|
headers: { ...(await getAuthHeaders(locale)), "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ code, name, ...(description ? { description } : {}) }),
|
body: JSON.stringify({ code, name, ...(description ? { description } : {}) }),
|
||||||
})
|
})
|
||||||
|
|
||||||
return handleSuccessResponse(res)
|
return handleSuccessResponse(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function editPosition(code: string, name: string, description?: string): Promise<{ success: boolean }> {
|
export async function editPosition(code: string, name: string, description?: string, locale?: string): Promise<{ success: boolean }> {
|
||||||
const token = await getAccessToken()
|
const token = await getAccessToken()
|
||||||
if (!token) return { success: false }
|
if (!token) return { success: false }
|
||||||
|
|
||||||
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/positions/${code}`, {
|
const res = await fetch(`${process.env.KOTOSOFT_ID_API_URL}/api/v1/admin/positions/${code}`, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: { ...(await getAuthHeaders()), "Content-Type": "application/json" },
|
headers: { ...(await getAuthHeaders(locale)), "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ name, ...(description ? { description } : {}) }),
|
body: JSON.stringify({ name, ...(description ? { description } : {}) }),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -2,46 +2,113 @@
|
|||||||
|
|
||||||
import Header from "@/components/header";
|
import Header from "@/components/header";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { useTranslations } from "next-intl";
|
import { useLocale, useTranslations } from "next-intl";
|
||||||
import type { Consent, Permission, Position, User } from "@/types";
|
import type { AdminUser, Consent, Document, Permission, Position, User } from "@/types";
|
||||||
import { AppWindowMacIcon, BriefcaseBusinessIcon, LogOutIcon, ShieldIcon, UserIcon } from "lucide-react";
|
import { AppWindowMacIcon, BriefcaseBusinessIcon, FileUserIcon, LogOutIcon, ShieldIcon, UserIcon } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { Logout } from "@/actions/auth";
|
import { Logout } from "@/actions/auth";
|
||||||
|
import { fetchAdminUsers, fetchAllPermissions, fetchAllPositions } from "@/actions/positions";
|
||||||
import Profile from "./items/profile";
|
import Profile from "./items/profile";
|
||||||
import Applications from "./items/applications";
|
import Applications from "./items/applications";
|
||||||
import Positions from "./items/positions";
|
import Positions from "./items/positions";
|
||||||
import Admin from "./items/admin";
|
import Admin from "./items/admin";
|
||||||
|
import Documents from "./items/documents";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
userData: User | null;
|
userData: User | null;
|
||||||
|
documentsData: Document[] | null;
|
||||||
consentsData: Consent[] | null;
|
consentsData: Consent[] | null;
|
||||||
permissionsData: Permission[] | null;
|
permissionsData: Permission[] | null;
|
||||||
positionsData: Position[] | null;
|
positionsData: Position[] | null;
|
||||||
|
adminUsersData: AdminUser[] | null;
|
||||||
|
canManagePositions: boolean;
|
||||||
|
canAssignPositions: boolean;
|
||||||
|
canRevokePositions: boolean;
|
||||||
|
canAccessAdmin: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function MeClient({ userData, consentsData, permissionsData, positionsData }: Props) {
|
export default function MeClient({
|
||||||
|
userData,
|
||||||
|
documentsData,
|
||||||
|
consentsData,
|
||||||
|
permissionsData,
|
||||||
|
positionsData,
|
||||||
|
adminUsersData,
|
||||||
|
canManagePositions,
|
||||||
|
canAssignPositions,
|
||||||
|
canRevokePositions,
|
||||||
|
canAccessAdmin,
|
||||||
|
}: Props) {
|
||||||
const t = useTranslations("MePage");
|
const t = useTranslations("MePage");
|
||||||
|
const locale = useLocale()
|
||||||
|
const hydratedRef = useRef(false)
|
||||||
|
|
||||||
const [user, setUser] = useState(userData);
|
const [user, setUser] = useState(userData);
|
||||||
|
const [documents, setDocuments] = useState(documentsData);
|
||||||
const [consents, setConsents] = useState(consentsData);
|
const [consents, setConsents] = useState(consentsData);
|
||||||
const [permissions, setPermissions] = useState(permissionsData);
|
const [permissions, setPermissions] = useState(permissionsData);
|
||||||
const [positions, setPositions] = useState(positionsData);
|
const [positions, setPositions] = useState(positionsData);
|
||||||
|
const [adminUsers, setAdminUsers] = useState(adminUsersData);
|
||||||
const [selectedItem, setSelectedItem] = useState(0);
|
const [selectedItem, setSelectedItem] = useState(0);
|
||||||
|
|
||||||
|
|
||||||
const baseItems = [
|
const baseItems = useMemo(() => [
|
||||||
{ name: t("items.profile.title"), icon: <UserIcon />, component: <Profile user={user} setUser={setUser} /> },
|
{ name: t("items.profile.title"), icon: <UserIcon />, component: <Profile user={user} setUser={setUser} /> },
|
||||||
|
{ name: "Documents", icon: <FileUserIcon/>, component: <Documents documents={documents} /> },
|
||||||
{ name: t("items.applications.title"), icon: <AppWindowMacIcon />, component: <Applications consents={consents} setConsents={setConsents} /> },
|
{ name: t("items.applications.title"), icon: <AppWindowMacIcon />, component: <Applications consents={consents} setConsents={setConsents} /> },
|
||||||
// { name: t("items.positions.title"), icon: <BriefcaseBusinessIcon />, component: <Positions /> },
|
{ name: t("items.positions.title"), icon: <BriefcaseBusinessIcon />, component: <Positions /> },
|
||||||
]
|
], [t, user, consents])
|
||||||
|
|
||||||
const adminItem = user?.is_admin
|
const adminItem = useMemo(() => canAccessAdmin
|
||||||
? [{ name: t("items.admin.title"), icon: <ShieldIcon />, component: <Admin permissions={permissions} setPermissions={setPermissions} positions={positions} setPositions={setPositions} /> }]
|
? [{
|
||||||
: [];
|
name: t("items.admin.title"),
|
||||||
|
icon: <ShieldIcon />,
|
||||||
|
component: (
|
||||||
|
<Admin
|
||||||
|
permissions={permissions}
|
||||||
|
setPermissions={setPermissions}
|
||||||
|
positions={positions}
|
||||||
|
setPositions={setPositions}
|
||||||
|
users={adminUsers}
|
||||||
|
setUsers={setAdminUsers}
|
||||||
|
canManagePositions={canManagePositions}
|
||||||
|
canAssignPositions={canAssignPositions}
|
||||||
|
canRevokePositions={canRevokePositions}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
}]
|
||||||
|
: [], [
|
||||||
|
canAccessAdmin,
|
||||||
|
t,
|
||||||
|
permissions,
|
||||||
|
positions,
|
||||||
|
adminUsers,
|
||||||
|
canManagePositions,
|
||||||
|
canAssignPositions,
|
||||||
|
canRevokePositions,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
const items = [...baseItems, ...adminItem]
|
const items = useMemo(() => [...baseItems, ...adminItem], [baseItems, adminItem])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!hydratedRef.current) {
|
||||||
|
hydratedRef.current = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!canAccessAdmin) return
|
||||||
|
|
||||||
|
if (canManagePositions) {
|
||||||
|
fetchAllPermissions(locale).then((data) => setPermissions(data))
|
||||||
|
}
|
||||||
|
if (canManagePositions || canAssignPositions || canRevokePositions) {
|
||||||
|
fetchAllPositions(locale).then((data) => setPositions(data))
|
||||||
|
}
|
||||||
|
if (canAssignPositions || canRevokePositions) {
|
||||||
|
fetchAdminUsers(locale).then((data) => setAdminUsers(data ?? []))
|
||||||
|
}
|
||||||
|
}, [locale, canAccessAdmin, canManagePositions, canAssignPositions, canRevokePositions])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useTranslations } from "next-intl"
|
import { useTranslations } from "next-intl"
|
||||||
import type { Permission, Position } from "@/types"
|
import type { AdminUser, Permission, Position } from "@/types"
|
||||||
import Permissions from "./admin/permissions"
|
import Permissions from "./admin/permissions"
|
||||||
import Positions from "./admin/positions";
|
import Positions from "./admin/positions";
|
||||||
|
import UserPositions from "./admin/userPositions";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
permissions: Permission[] | null;
|
permissions: Permission[] | null;
|
||||||
@@ -11,17 +12,45 @@ interface Props {
|
|||||||
|
|
||||||
positions: Position[] | null;
|
positions: Position[] | null;
|
||||||
setPositions: React.Dispatch<React.SetStateAction<Position[] | null>>;
|
setPositions: React.Dispatch<React.SetStateAction<Position[] | null>>;
|
||||||
|
users: AdminUser[] | null;
|
||||||
|
setUsers: React.Dispatch<React.SetStateAction<AdminUser[] | null>>;
|
||||||
|
canManagePositions: boolean;
|
||||||
|
canAssignPositions: boolean;
|
||||||
|
canRevokePositions: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Admin({ permissions, setPermissions, positions, setPositions }: Props) {
|
export default function Admin({
|
||||||
|
permissions,
|
||||||
|
setPermissions,
|
||||||
|
positions,
|
||||||
|
setPositions,
|
||||||
|
users,
|
||||||
|
setUsers,
|
||||||
|
canManagePositions,
|
||||||
|
canAssignPositions,
|
||||||
|
canRevokePositions,
|
||||||
|
}: Props) {
|
||||||
const t = useTranslations("MePage.items.admin")
|
const t = useTranslations("MePage.items.admin")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full lg:max-w-xl flex flex-col gap-6">
|
<div className="w-full lg:max-w-xl flex flex-col gap-6">
|
||||||
<h1 className="text-xl">{t("title")}</h1>
|
<h1 className="text-xl">{t("title")}</h1>
|
||||||
<div className="space-y-8">
|
<div className="space-y-8">
|
||||||
|
{canManagePositions && (
|
||||||
|
<>
|
||||||
<Permissions permissions={permissions} setPermissions={setPermissions} />
|
<Permissions permissions={permissions} setPermissions={setPermissions} />
|
||||||
<Positions positions={positions} setPositions={setPositions} />
|
<Positions positions={positions} setPositions={setPositions} permissions={permissions} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{(canAssignPositions || canRevokePositions) && (
|
||||||
|
<UserPositions
|
||||||
|
users={users}
|
||||||
|
setUsers={setUsers}
|
||||||
|
positions={positions}
|
||||||
|
canAssignPositions={canAssignPositions}
|
||||||
|
canRevokePositions={canRevokePositions}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useForm, SubmitHandler } from "react-hook-form";
|
import { useForm, SubmitHandler } from "react-hook-form";
|
||||||
import { useTranslations } from "next-intl";
|
import { useLocale, useTranslations } from "next-intl";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
@@ -35,6 +35,7 @@ interface FormData {
|
|||||||
|
|
||||||
export function PermissionDialog(props: Props) {
|
export function PermissionDialog(props: Props) {
|
||||||
const t = useTranslations("MePage.items.admin.permissions")
|
const t = useTranslations("MePage.items.admin.permissions")
|
||||||
|
const locale = useLocale()
|
||||||
const isEdit = props.mode === "edit"
|
const isEdit = props.mode === "edit"
|
||||||
|
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
@@ -49,8 +50,8 @@ export function PermissionDialog(props: Props) {
|
|||||||
|
|
||||||
const onSubmit: SubmitHandler<FormData> = async (data) => {
|
const onSubmit: SubmitHandler<FormData> = async (data) => {
|
||||||
const result = isEdit
|
const result = isEdit
|
||||||
? await editPermission((props as EditProps).permission.code, data.description || undefined)
|
? await editPermission((props as EditProps).permission.code, data.description || undefined, locale)
|
||||||
: await addPermission(data.code, data.description || undefined)
|
: await addPermission(data.code, data.description || undefined, locale)
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
toast(isEdit ? t("edit.error") : t("create.error"), { icon: <X size={16} /> })
|
toast(isEdit ? t("edit.error") : t("create.error"), { icon: <X size={16} /> })
|
||||||
@@ -59,7 +60,7 @@ export function PermissionDialog(props: Props) {
|
|||||||
|
|
||||||
const updated: Permission = isEdit
|
const updated: Permission = isEdit
|
||||||
? { ...(props as EditProps).permission, description: data.description }
|
? { ...(props as EditProps).permission, description: data.description }
|
||||||
: { id: crypto.randomUUID(), code: data.code, description: data.description, created_at: new Date().toISOString() }
|
: { id: crypto.randomUUID(), code: data.code, name: data.code, description: data.description, created_at: new Date().toISOString() }
|
||||||
|
|
||||||
toast(isEdit ? t("edit.success") : t("create.success"), { icon: <Check size={16} /> })
|
toast(isEdit ? t("edit.success") : t("create.success"), { icon: <Check size={16} /> })
|
||||||
props.onSuccess(updated)
|
props.onSuccess(updated)
|
||||||
|
|||||||
@@ -2,21 +2,22 @@
|
|||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useForm, SubmitHandler } from "react-hook-form";
|
import { useForm, SubmitHandler } from "react-hook-form";
|
||||||
import { useTranslations } from "next-intl";
|
import { useLocale, useTranslations } from "next-intl";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Field, FieldError, FieldGroup, FieldLabel } from "@/components/ui/field";
|
import { Field, FieldError, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||||
import { Spinner } from "@/components/ui/spinner";
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
import { addPosition, editPosition } from "@/actions/positions";
|
import { addPosition, editPosition, syncPositionPermissions } from "@/actions/positions";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { Check, X } from "lucide-react";
|
import { Check, X } from "lucide-react";
|
||||||
import type { Position } from "@/types";
|
import type { Permission, Position } from "@/types";
|
||||||
|
|
||||||
interface CreateProps {
|
interface CreateProps {
|
||||||
mode: "create";
|
mode: "create";
|
||||||
trigger: React.ReactNode;
|
trigger: React.ReactNode;
|
||||||
onSuccess: (position: Position) => void;
|
onSuccess: (position: Position) => void;
|
||||||
|
allPermissions: Permission[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EditProps {
|
interface EditProps {
|
||||||
@@ -24,6 +25,7 @@ interface EditProps {
|
|||||||
position: Position;
|
position: Position;
|
||||||
trigger: React.ReactNode;
|
trigger: React.ReactNode;
|
||||||
onSuccess: (position: Position) => void;
|
onSuccess: (position: Position) => void;
|
||||||
|
allPermissions: Permission[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Props = CreateProps | EditProps;
|
type Props = CreateProps | EditProps;
|
||||||
@@ -32,49 +34,100 @@ interface FormData {
|
|||||||
code: string;
|
code: string;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
permissions: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
function addPermissionToForm(current: string[], value: string): string[] {
|
||||||
|
if (current.includes(value)) return current
|
||||||
|
return [...current, value]
|
||||||
|
}
|
||||||
|
|
||||||
|
function removePermissionFromForm(current: string[], value: string): string[] {
|
||||||
|
return current.filter(p => p !== value)
|
||||||
|
}
|
||||||
|
|
||||||
|
function togglePermissionInForm(current: string[], value: string): string[] {
|
||||||
|
return current.includes(value) ?
|
||||||
|
removePermissionFromForm(current, value) :
|
||||||
|
addPermissionToForm(current, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PositionDialog(props: Props) {
|
export function PositionDialog(props: Props) {
|
||||||
const t = useTranslations("MePage.items.admin.positions")
|
const t = useTranslations("MePage.items.admin.positions")
|
||||||
|
const locale = useLocale()
|
||||||
const isEdit = props.mode === "edit"
|
const isEdit = props.mode === "edit"
|
||||||
|
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const { register, handleSubmit, reset, formState: { errors, isSubmitting } } = useForm<FormData>({
|
const { register, handleSubmit, reset, formState: { errors, isSubmitting }, watch, setValue } = useForm<FormData>({
|
||||||
defaultValues: isEdit
|
defaultValues: isEdit
|
||||||
? { code: props.position.code, name: props.position.name, description: props.position.description ?? "" }
|
? { code: props.position.code, name: props.position.name, description: props.position.description ?? "", permissions: props.position.permissions.map(p => p.code) ?? [] }
|
||||||
: { code: "", name: "", description: "" },
|
: { code: "", name: "", description: "", permissions: [] },
|
||||||
})
|
})
|
||||||
|
|
||||||
function handleOpenChange(o: boolean) {
|
function handleOpenChange(o: boolean) {
|
||||||
setOpen(o)
|
setOpen(o)
|
||||||
if (!o) {
|
if (!o) {
|
||||||
reset(isEdit
|
reset(isEdit
|
||||||
? { code: props.position.code, name: props.position.name, description: props.position.description ?? "" }
|
? { code: props.position.code, name: props.position.name, description: props.position.description ?? "", permissions: props.position.permissions.map(p => p.code) ?? [] }
|
||||||
: { code: "", name: "", description: "" }
|
: { code: "", name: "", description: "", permissions: [] }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSubmit: SubmitHandler<FormData> = async (data) => {
|
const onSubmit: SubmitHandler<FormData> = async (data) => {
|
||||||
|
const positionCode = isEdit
|
||||||
|
? (props as EditProps).position.code
|
||||||
|
: data.code
|
||||||
|
|
||||||
|
const oldPermissions = isEdit
|
||||||
|
? (props as EditProps).position.permissions.map(p => p.code)
|
||||||
|
: []
|
||||||
|
|
||||||
const result = isEdit
|
const result = isEdit
|
||||||
? await editPosition((props as EditProps).position.code, data.name, data.description || undefined)
|
? await editPosition(positionCode, data.name, data.description, locale)
|
||||||
: await addPosition(data.code, data.name, data.description || undefined)
|
: await addPosition(data.code, data.name, data.description, locale)
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
toast(isEdit ? t("edit.error") : t("create.error"), { icon: <X size={16} /> })
|
toast(isEdit ? t("edit.error") : t("create.error"), {
|
||||||
|
icon: <X size={16} />,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const updated: Position = isEdit
|
await syncPositionPermissions(
|
||||||
? { ...(props as EditProps).position, name: data.name, description: data.description }
|
positionCode,
|
||||||
: { code: data.code, name: data.name, description: data.description, permissions: [] }
|
oldPermissions,
|
||||||
|
data.permissions
|
||||||
|
)
|
||||||
|
|
||||||
|
const nextPermissions = data.permissions.map((permissionCode) => {
|
||||||
|
const permission = props.allPermissions?.find((p) => p.code === permissionCode)
|
||||||
|
return permission ?? { id: permissionCode, code: permissionCode, name: permissionCode, description: permissionCode, created_at: new Date().toISOString() }
|
||||||
|
})
|
||||||
|
|
||||||
|
const updated: Position = {
|
||||||
|
...(isEdit ? (props as EditProps).position : { code: data.code }),
|
||||||
|
name: data.name,
|
||||||
|
description: data.description,
|
||||||
|
permissions: nextPermissions,
|
||||||
|
}
|
||||||
|
|
||||||
|
toast(isEdit ? t("edit.success") : t("create.success"), {
|
||||||
|
icon: <Check size={16} />,
|
||||||
|
})
|
||||||
|
|
||||||
toast(isEdit ? t("edit.success") : t("create.success"), { icon: <Check size={16} /> })
|
|
||||||
props.onSuccess(updated)
|
props.onSuccess(updated)
|
||||||
reset()
|
reset()
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectedPermissions = watch("permissions");
|
||||||
|
|
||||||
|
const togglePermission = (value: string) => {
|
||||||
|
const updated = togglePermissionInForm(selectedPermissions, value)
|
||||||
|
setValue("permissions", updated, { shouldDirty: true, shouldValidate: true })
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||||
<DialogTrigger asChild>{props.trigger}</DialogTrigger>
|
<DialogTrigger asChild>{props.trigger}</DialogTrigger>
|
||||||
@@ -112,10 +165,29 @@ export function PositionDialog(props: Props) {
|
|||||||
{...register("description")}
|
{...register("description")}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
<Field>
|
||||||
|
<FieldLabel htmlFor="permissions">{t("permissions.label")}</FieldLabel>
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
{props.allPermissions?.length == 0 && <p className="text-sm text-muted-foreground">{t("permissions.empty")}</p>}
|
||||||
|
{props.allPermissions?.map((p) => {
|
||||||
|
const active = selectedPermissions.includes(p.code)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
key={p.id}
|
||||||
|
variant={active ? "default" : "ghost"}
|
||||||
|
onClick={(e) => {e.preventDefault(); togglePermission(p.code)}}
|
||||||
|
>
|
||||||
|
{p.description || p.name || p.code}
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</Field>
|
||||||
</FieldGroup>
|
</FieldGroup>
|
||||||
<DialogFooter className="mt-6">
|
<DialogFooter className="mt-6">
|
||||||
<DialogClose asChild>
|
<DialogClose asChild>
|
||||||
<Button variant="outline">{t("create.cancel") || t("edit.cancel")}</Button>
|
<Button variant="outline">{isEdit ? t("edit.cancel") : t("create.cancel")}</Button>
|
||||||
</DialogClose>
|
</DialogClose>
|
||||||
<Button type="submit" disabled={isSubmitting}>
|
<Button type="submit" disabled={isSubmitting}>
|
||||||
{isSubmitting && <Spinner className="mr-2 size-4" />}
|
{isSubmitting && <Spinner className="mr-2 size-4" />}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ interface Props {
|
|||||||
|
|
||||||
export default function Permissions({ permissions, setPermissions }: Props) {
|
export default function Permissions({ permissions, setPermissions }: Props) {
|
||||||
const t = useTranslations("MePage.items.admin.permissions")
|
const t = useTranslations("MePage.items.admin.permissions")
|
||||||
const pt = useTranslations("permissions")
|
|
||||||
|
|
||||||
function handleCreated(permission: Permission) {
|
function handleCreated(permission: Permission) {
|
||||||
setPermissions((prev) => [...(prev || []), permission])
|
setPermissions((prev) => [...(prev || []), permission])
|
||||||
@@ -61,7 +60,7 @@ export default function Permissions({ permissions, setPermissions }: Props) {
|
|||||||
{permissions?.map((permission) => (
|
{permissions?.map((permission) => (
|
||||||
<TableRow key={permission.code}>
|
<TableRow key={permission.code}>
|
||||||
<TableCell className="font-mono">{permission.code}</TableCell>
|
<TableCell className="font-mono">{permission.code}</TableCell>
|
||||||
<TableCell className="text-muted-foreground">{pt(`${permission.code}`)}</TableCell>
|
<TableCell className="text-muted-foreground">{permission.description || permission.name || permission.code}</TableCell>
|
||||||
<TableCell className="text-right">
|
<TableCell className="text-right">
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
|
|||||||
@@ -9,14 +9,15 @@ import { Check, X } from "lucide-react";
|
|||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { PositionDialog } from "./dialogs/positionDialog";
|
import { PositionDialog } from "./dialogs/positionDialog";
|
||||||
import { deletePosition } from "@/actions/positions";
|
import { deletePosition } from "@/actions/positions";
|
||||||
import type { Position } from "@/types";
|
import type { Permission, Position } from "@/types";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
positions: Position[] | null;
|
positions: Position[] | null;
|
||||||
|
permissions: Permission[] | null;
|
||||||
setPositions: React.Dispatch<React.SetStateAction<Position[] | null>>;
|
setPositions: React.Dispatch<React.SetStateAction<Position[] | null>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Positions({ positions, setPositions }: Props) {
|
export default function Positions({ positions, permissions, setPositions }: Props) {
|
||||||
const t = useTranslations("MePage.items.admin.positions")
|
const t = useTranslations("MePage.items.admin.positions")
|
||||||
|
|
||||||
function handleCreated(position: Position) {
|
function handleCreated(position: Position) {
|
||||||
@@ -77,6 +78,7 @@ export default function Positions({ positions, setPositions }: Props) {
|
|||||||
position={position}
|
position={position}
|
||||||
onSuccess={(updated) => handleUpdated(position.code, updated)}
|
onSuccess={(updated) => handleUpdated(position.code, updated)}
|
||||||
trigger={<Button variant="ghost" size="sm" className="w-full px-2 justify-start">{t("actions.edit")}</Button>}
|
trigger={<Button variant="ghost" size="sm" className="w-full px-2 justify-start">{t("actions.edit")}</Button>}
|
||||||
|
allPermissions={permissions}
|
||||||
/>
|
/>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem variant="destructive" onClick={() => handleDelete(position.code)}>{t("actions.delete")}</DropdownMenuItem>
|
<DropdownMenuItem variant="destructive" onClick={() => handleDelete(position.code)}>{t("actions.delete")}</DropdownMenuItem>
|
||||||
@@ -91,6 +93,7 @@ export default function Positions({ positions, setPositions }: Props) {
|
|||||||
mode="create"
|
mode="create"
|
||||||
onSuccess={handleCreated}
|
onSuccess={handleCreated}
|
||||||
trigger={<Button variant="outline" size="sm" className="w-full">{t("actions.create")}</Button>}
|
trigger={<Button variant="outline" size="sm" className="w-full">{t("actions.create")}</Button>}
|
||||||
|
allPermissions={permissions}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { assignPositionToUser, revokePositionFromUser } from "@/actions/positions";
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
||||||
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||||
|
import type { AdminUser, Position } from "@/types";
|
||||||
|
import { Check, MoreHorizontalIcon, X } from "lucide-react";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
users: AdminUser[] | null;
|
||||||
|
setUsers: React.Dispatch<React.SetStateAction<AdminUser[] | null>>;
|
||||||
|
positions: Position[] | null;
|
||||||
|
canAssignPositions: boolean;
|
||||||
|
canRevokePositions: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function UserPositions({
|
||||||
|
users,
|
||||||
|
setUsers,
|
||||||
|
positions,
|
||||||
|
canAssignPositions,
|
||||||
|
canRevokePositions,
|
||||||
|
}: Props) {
|
||||||
|
const t = useTranslations("MePage.items.admin.userPositions")
|
||||||
|
|
||||||
|
async function handleAssign(userId: string, positionCode: string) {
|
||||||
|
const result = await assignPositionToUser(userId, positionCode)
|
||||||
|
if (!result.success) {
|
||||||
|
toast(t("assign.error"), { icon: <X size={16} /> })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const added = positions?.find((p) => p.code === positionCode)
|
||||||
|
if (added) {
|
||||||
|
setUsers((prev) => (prev || []).map((u) => {
|
||||||
|
if (u.id !== userId) return u
|
||||||
|
if (u.positions.some((p) => p.code === positionCode)) return u
|
||||||
|
return { ...u, positions: [...u.positions, added] }
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
toast(t("assign.success"), { icon: <Check size={16} /> })
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleRevoke(userId: string, positionCode: string) {
|
||||||
|
const result = await revokePositionFromUser(userId, positionCode)
|
||||||
|
if (!result.success) {
|
||||||
|
toast(t("revoke.error"), { icon: <X size={16} /> })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setUsers((prev) => (prev || []).map((u) => (
|
||||||
|
u.id === userId
|
||||||
|
? { ...u, positions: u.positions.filter((p) => p.code !== positionCode) }
|
||||||
|
: u
|
||||||
|
)))
|
||||||
|
|
||||||
|
toast(t("revoke.success"), { icon: <Check size={16} /> })
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<div className="space-y-1">
|
||||||
|
<h2 className="text-lg">{t("title")}</h2>
|
||||||
|
<p className="text-sm text-muted-foreground">{t("subtitle")}</p>
|
||||||
|
</div>
|
||||||
|
<Table>
|
||||||
|
<TableHeader className="rounded-lg">
|
||||||
|
<TableRow>
|
||||||
|
<TableHead>{t("columns.user")}</TableHead>
|
||||||
|
<TableHead>{t("columns.positions")}</TableHead>
|
||||||
|
<TableHead className="text-right">{t("columns.actions")}</TableHead>
|
||||||
|
</TableRow>
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
{users === null && (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell colSpan={3} className="text-center text-sm text-muted-foreground py-6">{t("loadError")}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)}
|
||||||
|
{users?.length === 0 && (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell colSpan={3} className="text-center text-sm text-muted-foreground py-6">{t("empty")}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)}
|
||||||
|
{users?.map((user) => (
|
||||||
|
<TableRow key={user.id}>
|
||||||
|
<TableCell>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<span>{user.first_name} {user.second_name}</span>
|
||||||
|
<span className="text-xs text-muted-foreground">{user.email}</span>
|
||||||
|
</div>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<div className="flex flex-wrap gap-1">
|
||||||
|
{user.positions.length === 0 && <span className="text-sm text-muted-foreground">{t("noPositions")}</span>}
|
||||||
|
{user.positions.map((position) => (
|
||||||
|
<Badge key={position.code} variant="secondary">{position.name || position.code}</Badge>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell className="text-right">
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button variant="ghost" size="icon" className="size-8">
|
||||||
|
<MoreHorizontalIcon />
|
||||||
|
<span className="sr-only">{t("columns.actions")}</span>
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end">
|
||||||
|
{canAssignPositions && (positions || []).map((position) => (
|
||||||
|
<DropdownMenuItem
|
||||||
|
key={`assign-${user.id}-${position.code}`}
|
||||||
|
disabled={user.positions.some((p) => p.code === position.code)}
|
||||||
|
onClick={() => handleAssign(user.id, position.code)}
|
||||||
|
>
|
||||||
|
{t("actions.assign")} {position.name}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
))}
|
||||||
|
{canAssignPositions && (user.positions.filter(p => p.code !== "kotosoft_id_staff")).length > 0 && canRevokePositions && <DropdownMenuSeparator />}
|
||||||
|
{canRevokePositions && user.positions.filter(p => p.code !== "kotosoft_id_staff").map((position) => (
|
||||||
|
<DropdownMenuItem
|
||||||
|
key={`revoke-${user.id}-${position.code}`}
|
||||||
|
variant="destructive"
|
||||||
|
onClick={() => handleRevoke(user.id, position.code)}
|
||||||
|
>
|
||||||
|
{t("actions.revoke")} {position.name}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
))}
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { useLocale, useTranslations } from "next-intl";
|
||||||
|
import type { Document } from "@/types";
|
||||||
|
import { Item, ItemActions, ItemContent, ItemDescription, ItemTitle } from "@/components/ui/item";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
|
import { localeMap } from "@/types";
|
||||||
|
import { enUS } from "date-fns/locale";
|
||||||
|
import { format } from "date-fns";
|
||||||
|
import { revokeConsent } from "@/actions/consents";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
import { Check, X } from "lucide-react";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
documents: Document[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Documents({ documents }: Props) {
|
||||||
|
const t = useTranslations("MePage.items.applications");
|
||||||
|
|
||||||
|
const locale = useLocale();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full lg:max-w-sm flex flex-col gap-4">
|
||||||
|
<div className="space-y-2">
|
||||||
|
<h1 className="text-xl">Documents</h1>
|
||||||
|
<p className="text-sm text-muted-foreground">There you can find all of your documents issued by the European Federation</p>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-4">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,16 +8,25 @@ import { Badge } from "@/components/ui/badge"
|
|||||||
import { Spinner } from "@/components/ui/spinner"
|
import { Spinner } from "@/components/ui/spinner"
|
||||||
import { fetchMyPositions } from "@/actions/positions"
|
import { fetchMyPositions } from "@/actions/positions"
|
||||||
|
|
||||||
|
const positionsCache: Record<string, Position[]> = {}
|
||||||
|
|
||||||
export default function Positions() {
|
export default function Positions() {
|
||||||
const t = useTranslations("MePage.items.positions")
|
const t = useTranslations("MePage.items.positions")
|
||||||
const locale = useLocale()
|
const locale = useLocale()
|
||||||
|
const [positions, setPositions] = useState<Position[] | null>(
|
||||||
const [positions, setPositions] = useState<Position[] | null>(null)
|
() => positionsCache[locale] ?? null
|
||||||
const [loading, setLoading] = useState(true)
|
)
|
||||||
|
const [loading, setLoading] = useState(!positionsCache[locale])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (positionsCache[locale]) return
|
||||||
|
|
||||||
|
setLoading(true)
|
||||||
fetchMyPositions(locale)
|
fetchMyPositions(locale)
|
||||||
.then(setPositions)
|
.then((data) => {
|
||||||
|
positionsCache[locale] = data
|
||||||
|
setPositions(data)
|
||||||
|
})
|
||||||
.finally(() => setLoading(false))
|
.finally(() => setLoading(false))
|
||||||
}, [locale])
|
}, [locale])
|
||||||
|
|
||||||
@@ -45,8 +54,8 @@ export default function Positions() {
|
|||||||
{position.permissions.length > 0 && (
|
{position.permissions.length > 0 && (
|
||||||
<div className="flex flex-wrap gap-1 mt-2">
|
<div className="flex flex-wrap gap-1 mt-2">
|
||||||
{position.permissions.map((perm) => (
|
{position.permissions.map((perm) => (
|
||||||
<Badge key={perm.code} variant="secondary" className="text-xs font-mono">
|
<Badge key={perm.code} variant="secondary" className="text-xs">
|
||||||
{perm.code}
|
{perm.description}
|
||||||
</Badge>
|
</Badge>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,18 +2,48 @@ import { fetchUser } from "@/actions/auth";
|
|||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import MeComponent from "./component";
|
import MeComponent from "./component";
|
||||||
import { fetchConsents } from "@/actions/consents";
|
import { fetchConsents } from "@/actions/consents";
|
||||||
import { fetchAllPositions, fetchAllPermissions } from "@/actions/positions";
|
import { fetchAllPositions, fetchAllPermissions, fetchAdminUsers, fetchMyPositions } from "@/actions/positions";
|
||||||
|
import { getLocale } from "next-intl/server";
|
||||||
|
import { Document } from "@/types";
|
||||||
|
|
||||||
export default async function Me() {
|
export default async function Me() {
|
||||||
|
const locale = await getLocale();
|
||||||
const user = await fetchUser();
|
const user = await fetchUser();
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
redirect("/api/auth/initiate");
|
redirect("/api/auth/initiate");
|
||||||
}
|
}
|
||||||
|
|
||||||
const consents = await fetchConsents();
|
const documents: Document[] = [];
|
||||||
const permissions = user.is_admin ? await fetchAllPermissions() : null;
|
|
||||||
const positions = user.is_admin ? await fetchAllPositions() : null;
|
|
||||||
|
|
||||||
return <MeComponent userData={user} consentsData={consents} permissionsData={permissions} positionsData={positions} />;
|
const [consents, myPositions] = await Promise.all([
|
||||||
|
fetchConsents(),
|
||||||
|
fetchMyPositions(locale),
|
||||||
|
]);
|
||||||
|
const granted = new Set(myPositions.flatMap((position) => position.permissions.map((p) => p.code)));
|
||||||
|
const canManage = granted.has("positions.manage");
|
||||||
|
const canAssign = granted.has("positions.assign");
|
||||||
|
const canRevoke = granted.has("positions.revoke");
|
||||||
|
const canAccessAdmin = canManage || canAssign || canRevoke;
|
||||||
|
|
||||||
|
const [permissions, positions, adminUsers] = await Promise.all([
|
||||||
|
canAccessAdmin && canManage ? fetchAllPermissions(locale) : Promise.resolve<null>(null),
|
||||||
|
canAccessAdmin && (canManage || canAssign || canRevoke) ? fetchAllPositions(locale) : Promise.resolve<null>(null),
|
||||||
|
canAccessAdmin && (canAssign || canRevoke) ? fetchAdminUsers(locale).then((data) => data ?? []) : Promise.resolve<null>(null),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MeComponent
|
||||||
|
userData={user}
|
||||||
|
documentsData={documents}
|
||||||
|
consentsData={consents}
|
||||||
|
permissionsData={permissions}
|
||||||
|
positionsData={positions}
|
||||||
|
adminUsersData={adminUsers}
|
||||||
|
canManagePositions={canManage}
|
||||||
|
canAssignPositions={canAssign}
|
||||||
|
canRevokePositions={canRevoke}
|
||||||
|
canAccessAdmin={canAccessAdmin}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
|
"configVersion": 0,
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"": {
|
"": {
|
||||||
"name": "kotosoft-id-frontend",
|
"name": "kotosoft-id-frontend",
|
||||||
@@ -8,28 +9,28 @@
|
|||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"lucide-react": "^0.575.0",
|
"lucide-react": "^0.575.0",
|
||||||
"next": "16.1.6",
|
"next": "^16.2.3",
|
||||||
"next-intl": "^4.8.3",
|
"next-intl": "^4.9.1",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"radix-ui": "^1.4.3",
|
"radix-ui": "^1.4.3",
|
||||||
"react": "19.2.3",
|
"react": "19.2.3",
|
||||||
"react-day-picker": "^9.14.0",
|
"react-day-picker": "^9.14.0",
|
||||||
"react-dom": "19.2.3",
|
"react-dom": "19.2.3",
|
||||||
"react-hook-form": "^7.71.2",
|
"react-hook-form": "^7.72.1",
|
||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.5.0",
|
"tailwind-merge": "^3.5.0",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4.2.2",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20.19.39",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19.2.14",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19.2.3",
|
||||||
"eslint": "^9",
|
"eslint": "^9.39.4",
|
||||||
"eslint-config-next": "16.1.6",
|
"eslint-config-next": "16.1.6",
|
||||||
"shadcn": "^3.8.5",
|
"shadcn": "^3.8.5",
|
||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4.2.2",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"typescript": "^5",
|
"typescript": "^5.9.3",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -114,15 +115,15 @@
|
|||||||
|
|
||||||
"@eslint-community/regexpp": ["@eslint-community/[email protected]", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],
|
"@eslint-community/regexpp": ["@eslint-community/[email protected]", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],
|
||||||
|
|
||||||
"@eslint/config-array": ["@eslint/[email protected].1", "", { "dependencies": { "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", "minimatch": "^3.1.2" } }, "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA=="],
|
"@eslint/config-array": ["@eslint/[email protected].2", "", { "dependencies": { "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", "minimatch": "^3.1.5" } }, "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw=="],
|
||||||
|
|
||||||
"@eslint/config-helpers": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^0.17.0" } }, "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw=="],
|
"@eslint/config-helpers": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^0.17.0" } }, "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw=="],
|
||||||
|
|
||||||
"@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ=="],
|
"@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ=="],
|
||||||
|
|
||||||
"@eslint/eslintrc": ["@eslint/[email protected].4", "", { "dependencies": { "ajv": "^6.14.0", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.1", "minimatch": "^3.1.3", "strip-json-comments": "^3.1.1" } }, "sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ=="],
|
"@eslint/eslintrc": ["@eslint/[email protected].5", "", { "dependencies": { "ajv": "^6.14.0", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.1", "minimatch": "^3.1.5", "strip-json-comments": "^3.1.1" } }, "sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg=="],
|
||||||
|
|
||||||
"@eslint/js": ["@eslint/[email protected].3", "", {}, "sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw=="],
|
"@eslint/js": ["@eslint/[email protected].4", "", {}, "sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw=="],
|
||||||
|
|
||||||
"@eslint/object-schema": ["@eslint/[email protected]", "", {}, "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA=="],
|
"@eslint/object-schema": ["@eslint/[email protected]", "", {}, "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA=="],
|
||||||
|
|
||||||
@@ -232,25 +233,25 @@
|
|||||||
|
|
||||||
"@napi-rs/wasm-runtime": ["@napi-rs/[email protected]", "", { "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", "@tybys/wasm-util": "^0.10.0" } }, "sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ=="],
|
"@napi-rs/wasm-runtime": ["@napi-rs/[email protected]", "", { "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", "@tybys/wasm-util": "^0.10.0" } }, "sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ=="],
|
||||||
|
|
||||||
"@next/env": ["@next/env@16.1.6", "", {}, "sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ=="],
|
"@next/env": ["@next/env@16.2.3", "", {}, "sha512-ZWXyj4uNu4GCWQw9cjRxWlbD+33mcDszIo9iQxFnBX3Wmgq9ulaSJcl6VhuWx5pCWqqD+9W6Wfz7N0lM5lYPMA=="],
|
||||||
|
|
||||||
"@next/eslint-plugin-next": ["@next/[email protected]", "", { "dependencies": { "fast-glob": "3.3.1" } }, "sha512-/Qq3PTagA6+nYVfryAtQ7/9FEr/6YVyvOtl6rZnGsbReGLf0jZU6gkpr1FuChAQpvV46a78p4cmHOVP8mbfSMQ=="],
|
"@next/eslint-plugin-next": ["@next/[email protected]", "", { "dependencies": { "fast-glob": "3.3.1" } }, "sha512-/Qq3PTagA6+nYVfryAtQ7/9FEr/6YVyvOtl6rZnGsbReGLf0jZU6gkpr1FuChAQpvV46a78p4cmHOVP8mbfSMQ=="],
|
||||||
|
|
||||||
"@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@16.1.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-wTzYulosJr/6nFnqGW7FrG3jfUUlEf8UjGA0/pyypJl42ExdVgC6xJgcXQ+V8QFn6niSG2Pb8+MIG1mZr2vczw=="],
|
"@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@16.2.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-u37KDKTKQ+OQLvY+z7SNXixwo4Q2/IAJFDzU1fYe66IbCE51aDSAzkNDkWmLN0yjTUh4BKBd+hb69jYn6qqqSg=="],
|
||||||
|
|
||||||
"@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.1.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-BLFPYPDO+MNJsiDWbeVzqvYd4NyuRrEYVB5k2N3JfWncuHAy2IVwMAOlVQDFjj+krkWzhY2apvmekMkfQR0CUQ=="],
|
"@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.2.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-gHjL/qy6Q6CG3176FWbAKyKh9IfntKZTB3RY/YOJdDFpHGsUDXVH38U4mMNpHVGXmeYW4wj22dMp1lTfmu/bTQ=="],
|
||||||
|
|
||||||
"@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.1.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-OJYkCd5pj/QloBvoEcJ2XiMnlJkRv9idWA/j0ugSuA34gMT6f5b7vOiCQHVRpvStoZUknhl6/UxOXL4OwtdaBw=="],
|
"@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.2.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-U6vtblPtU/P14Y/b/n9ZY0GOxbbIhTFuaFR7F4/uMBidCi2nSdaOFhA0Go81L61Zd6527+yvuX44T4ksnf8T+Q=="],
|
||||||
|
|
||||||
"@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.1.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-S4J2v+8tT3NIO9u2q+S0G5KdvNDjXfAv06OhfOzNDaBn5rw84DGXWndOEB7d5/x852A20sW1M56vhC/tRVbccQ=="],
|
"@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.2.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-/YV0LgjHUmfhQpn9bVoGc4x4nan64pkhWR5wyEV8yCOfwwrH630KpvRg86olQHTwHIn1z59uh6JwKvHq1h4QEw=="],
|
||||||
|
|
||||||
"@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.1.6", "", { "os": "linux", "cpu": "x64" }, "sha512-2eEBDkFlMMNQnkTyPBhQOAyn2qMxyG2eE7GPH2WIDGEpEILcBPI/jdSv4t6xupSP+ot/jkfrCShLAa7+ZUPcJQ=="],
|
"@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.2.3", "", { "os": "linux", "cpu": "x64" }, "sha512-/HiWEcp+WMZ7VajuiMEFGZ6cg0+aYZPqCJD3YJEfpVWQsKYSjXQG06vJP6F1rdA03COD9Fef4aODs3YxKx+RDQ=="],
|
||||||
|
|
||||||
"@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.1.6", "", { "os": "linux", "cpu": "x64" }, "sha512-oicJwRlyOoZXVlxmIMaTq7f8pN9QNbdes0q2FXfRsPhfCi8n8JmOZJm5oo1pwDaFbnnD421rVU409M3evFbIqg=="],
|
"@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.2.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Kt44hGJfZSefebhk/7nIdivoDr3Ugp5+oNz9VvF3GUtfxutucUIHfIO0ZYO8QlOPDQloUVQn4NVC/9JvHRk9hw=="],
|
||||||
|
|
||||||
"@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.1.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-gQmm8izDTPgs+DCWH22kcDmuUp7NyiJgEl18bcr8irXA5N2m2O+JQIr6f3ct42GOs9c0h8QF3L5SzIxcYAAXXw=="],
|
"@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.2.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-O2NZ9ie3Tq6xj5Z5CSwBT3+aWAMW2PIZ4egUi9MaWLkwaehgtB7YZjPm+UpcNpKOme0IQuqDcor7BsW6QBiQBw=="],
|
||||||
|
|
||||||
"@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.1.6", "", { "os": "win32", "cpu": "x64" }, "sha512-NRfO39AIrzBnixKbjuo2YiYhB6o9d8v/ymU9m/Xk8cyVk+k7XylniXkHwjs4s70wedVffc6bQNbufk5v0xEm0A=="],
|
"@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@16.2.3", "", { "os": "win32", "cpu": "x64" }, "sha512-Ibm29/GgB/ab5n7XKqlStkm54qqZE8v2FnijUPBgrd67FWrac45o/RsNlaOWjme/B5UqeWt/8KM4aWBwA1D2Kw=="],
|
||||||
|
|
||||||
"@noble/ciphers": ["@noble/[email protected]", "", {}, "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw=="],
|
"@noble/ciphers": ["@noble/[email protected]", "", {}, "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw=="],
|
||||||
|
|
||||||
@@ -458,35 +459,35 @@
|
|||||||
|
|
||||||
"@tabby_ai/hijri-converter": ["@tabby_ai/[email protected]", "", {}, "sha512-r5bClKrcIusDoo049dSL8CawnHR6mRdDwhlQuIgZRNty68q0x8k3Lf1BtPAMxRf/GgnHBnIO4ujd3+GQdLWzxQ=="],
|
"@tabby_ai/hijri-converter": ["@tabby_ai/[email protected]", "", {}, "sha512-r5bClKrcIusDoo049dSL8CawnHR6mRdDwhlQuIgZRNty68q0x8k3Lf1BtPAMxRf/GgnHBnIO4ujd3+GQdLWzxQ=="],
|
||||||
|
|
||||||
"@tailwindcss/node": ["@tailwindcss/[email protected].1", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "enhanced-resolve": "^5.19.0", "jiti": "^2.6.1", "lightningcss": "1.31.1", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.2.1" } }, "sha512-jlx6sLk4EOwO6hHe1oCGm1Q4AN/s0rSrTTPBGPM0/RQ6Uylwq17FuU8IeJJKEjtc6K6O07zsvP+gDO6MMWo7pg=="],
|
"@tailwindcss/node": ["@tailwindcss/[email protected].2", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "enhanced-resolve": "^5.19.0", "jiti": "^2.6.1", "lightningcss": "1.32.0", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.2.2" } }, "sha512-pXS+wJ2gZpVXqFaUEjojq7jzMpTGf8rU6ipJz5ovJV6PUGmlJ+jvIwGrzdHdQ80Sg+wmQxUFuoW1UAAwHNEdFA=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide": ["@tailwindcss/[email protected].1", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.2.1", "@tailwindcss/oxide-darwin-arm64": "4.2.1", "@tailwindcss/oxide-darwin-x64": "4.2.1", "@tailwindcss/oxide-freebsd-x64": "4.2.1", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.2.1", "@tailwindcss/oxide-linux-arm64-gnu": "4.2.1", "@tailwindcss/oxide-linux-arm64-musl": "4.2.1", "@tailwindcss/oxide-linux-x64-gnu": "4.2.1", "@tailwindcss/oxide-linux-x64-musl": "4.2.1", "@tailwindcss/oxide-wasm32-wasi": "4.2.1", "@tailwindcss/oxide-win32-arm64-msvc": "4.2.1", "@tailwindcss/oxide-win32-x64-msvc": "4.2.1" } }, "sha512-yv9jeEFWnjKCI6/T3Oq50yQEOqmpmpfzG1hcZsAOaXFQPfzWprWrlHSdGPEF3WQTi8zu8ohC9Mh9J470nT5pUw=="],
|
"@tailwindcss/oxide": ["@tailwindcss/[email protected].2", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.2.2", "@tailwindcss/oxide-darwin-arm64": "4.2.2", "@tailwindcss/oxide-darwin-x64": "4.2.2", "@tailwindcss/oxide-freebsd-x64": "4.2.2", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.2.2", "@tailwindcss/oxide-linux-arm64-gnu": "4.2.2", "@tailwindcss/oxide-linux-arm64-musl": "4.2.2", "@tailwindcss/oxide-linux-x64-gnu": "4.2.2", "@tailwindcss/oxide-linux-x64-musl": "4.2.2", "@tailwindcss/oxide-wasm32-wasi": "4.2.2", "@tailwindcss/oxide-win32-arm64-msvc": "4.2.2", "@tailwindcss/oxide-win32-x64-msvc": "4.2.2" } }, "sha512-qEUA07+E5kehxYp9BVMpq9E8vnJuBHfJEC0vPC5e7iL/hw7HR61aDKoVoKzrG+QKp56vhNZe4qwkRmMC0zDLvg=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-android-arm64": ["@tailwindcss/[email protected].1", "", { "os": "android", "cpu": "arm64" }, "sha512-eZ7G1Zm5EC8OOKaesIKuw77jw++QJ2lL9N+dDpdQiAB/c/B2wDh0QPFHbkBVrXnwNugvrbJFk1gK2SsVjwWReg=="],
|
"@tailwindcss/oxide-android-arm64": ["@tailwindcss/[email protected].2", "", { "os": "android", "cpu": "arm64" }, "sha512-dXGR1n+P3B6748jZO/SvHZq7qBOqqzQ+yFrXpoOWWALWndF9MoSKAT3Q0fYgAzYzGhxNYOoysRvYlpixRBBoDg=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-darwin-arm64": ["@tailwindcss/[email protected].1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-q/LHkOstoJ7pI1J0q6djesLzRvQSIfEto148ppAd+BVQK0JYjQIFSK3JgYZJa+Yzi0DDa52ZsQx2rqytBnf8Hw=="],
|
"@tailwindcss/oxide-darwin-arm64": ["@tailwindcss/[email protected].2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-iq9Qjr6knfMpZHj55/37ouZeykwbDqF21gPFtfnhCCKGDcPI/21FKC9XdMO/XyBM7qKORx6UIhGgg6jLl7BZlg=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-darwin-x64": ["@tailwindcss/[email protected].1", "", { "os": "darwin", "cpu": "x64" }, "sha512-/f/ozlaXGY6QLbpvd/kFTro2l18f7dHKpB+ieXz+Cijl4Mt9AI2rTrpq7V+t04nK+j9XBQHnSMdeQRhbGyt6fw=="],
|
"@tailwindcss/oxide-darwin-x64": ["@tailwindcss/[email protected].2", "", { "os": "darwin", "cpu": "x64" }, "sha512-BlR+2c3nzc8f2G639LpL89YY4bdcIdUmiOOkv2GQv4/4M0vJlpXEa0JXNHhCHU7VWOKWT/CjqHdTP8aUuDJkuw=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-freebsd-x64": ["@tailwindcss/[email protected].1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-5e/AkgYJT/cpbkys/OU2Ei2jdETCLlifwm7ogMC7/hksI2fC3iiq6OcXwjibcIjPung0kRtR3TxEITkqgn0TcA=="],
|
"@tailwindcss/oxide-freebsd-x64": ["@tailwindcss/[email protected].2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-YUqUgrGMSu2CDO82hzlQ5qSb5xmx3RUrke/QgnoEx7KvmRJHQuZHZmZTLSuuHwFf0DJPybFMXMYf+WJdxHy/nQ=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-linux-arm-gnueabihf": ["@tailwindcss/[email protected].1", "", { "os": "linux", "cpu": "arm" }, "sha512-Uny1EcVTTmerCKt/1ZuKTkb0x8ZaiuYucg2/kImO5A5Y/kBz41/+j0gxUZl+hTF3xkWpDmHX+TaWhOtba2Fyuw=="],
|
"@tailwindcss/oxide-linux-arm-gnueabihf": ["@tailwindcss/[email protected].2", "", { "os": "linux", "cpu": "arm" }, "sha512-FPdhvsW6g06T9BWT0qTwiVZYE2WIFo2dY5aCSpjG/S/u1tby+wXoslXS0kl3/KXnULlLr1E3NPRRw0g7t2kgaQ=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-linux-arm64-gnu": ["@tailwindcss/[email protected].1", "", { "os": "linux", "cpu": "arm64" }, "sha512-CTrwomI+c7n6aSSQlsPL0roRiNMDQ/YzMD9EjcR+H4f0I1SQ8QqIuPnsVp7QgMkC1Qi8rtkekLkOFjo7OlEFRQ=="],
|
"@tailwindcss/oxide-linux-arm64-gnu": ["@tailwindcss/[email protected].2", "", { "os": "linux", "cpu": "arm64" }, "sha512-4og1V+ftEPXGttOO7eCmW7VICmzzJWgMx+QXAJRAhjrSjumCwWqMfkDrNu1LXEQzNAwz28NCUpucgQPrR4S2yw=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-linux-arm64-musl": ["@tailwindcss/[email protected].1", "", { "os": "linux", "cpu": "arm64" }, "sha512-WZA0CHRL/SP1TRbA5mp9htsppSEkWuQ4KsSUumYQnyl8ZdT39ntwqmz4IUHGN6p4XdSlYfJwM4rRzZLShHsGAQ=="],
|
"@tailwindcss/oxide-linux-arm64-musl": ["@tailwindcss/[email protected].2", "", { "os": "linux", "cpu": "arm64" }, "sha512-oCfG/mS+/+XRlwNjnsNLVwnMWYH7tn/kYPsNPh+JSOMlnt93mYNCKHYzylRhI51X+TbR+ufNhhKKzm6QkqX8ag=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-linux-x64-gnu": ["@tailwindcss/[email protected].1", "", { "os": "linux", "cpu": "x64" }, "sha512-qMFzxI2YlBOLW5PhblzuSWlWfwLHaneBE0xHzLrBgNtqN6mWfs+qYbhryGSXQjFYB1Dzf5w+LN5qbUTPhW7Y5g=="],
|
"@tailwindcss/oxide-linux-x64-gnu": ["@tailwindcss/[email protected].2", "", { "os": "linux", "cpu": "x64" }, "sha512-rTAGAkDgqbXHNp/xW0iugLVmX62wOp2PoE39BTCGKjv3Iocf6AFbRP/wZT/kuCxC9QBh9Pu8XPkv/zCZB2mcMg=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-linux-x64-musl": ["@tailwindcss/[email protected].1", "", { "os": "linux", "cpu": "x64" }, "sha512-5r1X2FKnCMUPlXTWRYpHdPYUY6a1Ar/t7P24OuiEdEOmms5lyqjDRvVY1yy9Rmioh+AunQ0rWiOTPE8F9A3v5g=="],
|
"@tailwindcss/oxide-linux-x64-musl": ["@tailwindcss/[email protected].2", "", { "os": "linux", "cpu": "x64" }, "sha512-XW3t3qwbIwiSyRCggeO2zxe3KWaEbM0/kW9e8+0XpBgyKU4ATYzcVSMKteZJ1iukJ3HgHBjbg9P5YPRCVUxlnQ=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-wasm32-wasi": ["@tailwindcss/[email protected].1", "", { "dependencies": { "@emnapi/core": "^1.8.1", "@emnapi/runtime": "^1.8.1", "@emnapi/wasi-threads": "^1.1.0", "@napi-rs/wasm-runtime": "^1.1.1", "@tybys/wasm-util": "^0.10.1", "tslib": "^2.8.1" }, "cpu": "none" }, "sha512-MGFB5cVPvshR85MTJkEvqDUnuNoysrsRxd6vnk1Lf2tbiqNlXpHYZqkqOQalydienEWOHHFyyuTSYRsLfxFJ2Q=="],
|
"@tailwindcss/oxide-wasm32-wasi": ["@tailwindcss/[email protected].2", "", { "dependencies": { "@emnapi/core": "^1.8.1", "@emnapi/runtime": "^1.8.1", "@emnapi/wasi-threads": "^1.1.0", "@napi-rs/wasm-runtime": "^1.1.1", "@tybys/wasm-util": "^0.10.1", "tslib": "^2.8.1" }, "cpu": "none" }, "sha512-eKSztKsmEsn1O5lJ4ZAfyn41NfG7vzCg496YiGtMDV86jz1q/irhms5O0VrY6ZwTUkFy/EKG3RfWgxSI3VbZ8Q=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-win32-arm64-msvc": ["@tailwindcss/[email protected].1", "", { "os": "win32", "cpu": "arm64" }, "sha512-YlUEHRHBGnCMh4Nj4GnqQyBtsshUPdiNroZj8VPkvTZSoHsilRCwXcVKnG9kyi0ZFAS/3u+qKHBdDc81SADTRA=="],
|
"@tailwindcss/oxide-win32-arm64-msvc": ["@tailwindcss/[email protected].2", "", { "os": "win32", "cpu": "arm64" }, "sha512-qPmaQM4iKu5mxpsrWZMOZRgZv1tOZpUm+zdhhQP0VhJfyGGO3aUKdbh3gDZc/dPLQwW4eSqWGrrcWNBZWUWaXQ=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/[email protected].1", "", { "os": "win32", "cpu": "x64" }, "sha512-rbO34G5sMWWyrN/idLeVxAZgAKWrn5LiR3/I90Q9MkA67s6T1oB0xtTe+0heoBvHSpbU9Mk7i6uwJnpo4u21XQ=="],
|
"@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/[email protected].2", "", { "os": "win32", "cpu": "x64" }, "sha512-1T/37VvI7WyH66b+vqHj/cLwnCxt7Qt3WFu5Q8hk65aOvlwAhs7rAp1VkulBJw/N4tMirXjVnylTR72uI0HGcA=="],
|
||||||
|
|
||||||
"@tailwindcss/postcss": ["@tailwindcss/[email protected].1", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "@tailwindcss/node": "4.2.1", "@tailwindcss/oxide": "4.2.1", "postcss": "^8.5.6", "tailwindcss": "4.2.1" } }, "sha512-OEwGIBnXnj7zJeonOh6ZG9woofIjGrd2BORfvE5p9USYKDCZoQmfqLcfNiRWoJlRWLdNPn2IgVZuWAOM4iTYMw=="],
|
"@tailwindcss/postcss": ["@tailwindcss/[email protected].2", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "@tailwindcss/node": "4.2.2", "@tailwindcss/oxide": "4.2.2", "postcss": "^8.5.6", "tailwindcss": "4.2.2" } }, "sha512-n4goKQbW8RVXIbNKRB/45LzyUqN451deQK0nzIeauVEqjlI49slUlgKYJM2QyUzap/PcpnS7kzSUmPb1sCRvYQ=="],
|
||||||
|
|
||||||
"@ts-morph/common": ["@ts-morph/[email protected]", "", { "dependencies": { "fast-glob": "^3.3.3", "minimatch": "^10.0.1", "path-browserify": "^1.0.1" } }, "sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ=="],
|
"@ts-morph/common": ["@ts-morph/[email protected]", "", { "dependencies": { "fast-glob": "^3.3.3", "minimatch": "^10.0.1", "path-browserify": "^1.0.1" } }, "sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ=="],
|
||||||
|
|
||||||
@@ -498,7 +499,7 @@
|
|||||||
|
|
||||||
"@types/json5": ["@types/[email protected]", "", {}, "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ=="],
|
"@types/json5": ["@types/[email protected]", "", {}, "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ=="],
|
||||||
|
|
||||||
"@types/node": ["@types/[email protected]5", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-Uarfe6J91b9HAUXxjvSOdiO2UPOKLm07Q1oh0JHxoZ1y8HoqxDAu3gVrsrOHeiio0kSsoVBt4wFrKOm0dKxVPQ=="],
|
"@types/node": ["@types/[email protected]9", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-orrrD74MBUyK8jOAD/r0+lfa1I2MO6I+vAkmAWzMYbCcgrN4lCrmK52gRFQq/JRxfYPfonkr4b0jcY7Olqdqbw=="],
|
||||||
|
|
||||||
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w=="],
|
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w=="],
|
||||||
|
|
||||||
@@ -776,7 +777,7 @@
|
|||||||
|
|
||||||
"escape-string-regexp": ["[email protected]", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
|
"escape-string-regexp": ["[email protected]", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
|
||||||
|
|
||||||
"eslint": ["[email protected].3", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.39.3", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg=="],
|
"eslint": ["[email protected].4", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.2", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.5", "@eslint/js": "9.39.4", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ=="],
|
||||||
|
|
||||||
"eslint-config-next": ["[email protected]", "", { "dependencies": { "@next/eslint-plugin-next": "16.1.6", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.32.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.0", "eslint-plugin-react-hooks": "^7.0.0", "globals": "16.4.0", "typescript-eslint": "^8.46.0" }, "peerDependencies": { "eslint": ">=9.0.0", "typescript": ">=3.3.1" }, "optionalPeers": ["typescript"] }, "sha512-vKq40io2B0XtkkNDYyleATwblNt8xuh3FWp8SpSz3pt7P01OkBFlKsJZ2mWt5WsCySlDQLckb1zMY9yE9Qy0LA=="],
|
"eslint-config-next": ["[email protected]", "", { "dependencies": { "@next/eslint-plugin-next": "16.1.6", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.32.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.0", "eslint-plugin-react-hooks": "^7.0.0", "globals": "16.4.0", "typescript-eslint": "^8.46.0" }, "peerDependencies": { "eslint": ">=9.0.0", "typescript": ">=3.3.1" }, "optionalPeers": ["typescript"] }, "sha512-vKq40io2B0XtkkNDYyleATwblNt8xuh3FWp8SpSz3pt7P01OkBFlKsJZ2mWt5WsCySlDQLckb1zMY9yE9Qy0LA=="],
|
||||||
|
|
||||||
@@ -936,7 +937,7 @@
|
|||||||
|
|
||||||
"iconv-lite": ["[email protected]", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
|
"iconv-lite": ["[email protected]", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
|
||||||
|
|
||||||
"icu-minify": ["icu-minify@4.8.3", "", { "dependencies": { "@formatjs/icu-messageformat-parser": "^3.4.0" } }, "sha512-65Av7FLosNk7bPbmQx5z5XG2Y3T2GFppcjiXh4z1idHeVgQxlDpAmkGoYI0eFzAvrOnjpWTL5FmPDhsdfRMPEA=="],
|
"icu-minify": ["icu-minify@4.9.1", "", { "dependencies": { "@formatjs/icu-messageformat-parser": "^3.4.0" } }, "sha512-6NkfF9GHHFouqnz+wuiLjCWQiyxoEyJ5liUv4Jxxo/8wyhV7MY0L0iTEGDAVEa4aAD58WqTxFMa20S5nyMjwNw=="],
|
||||||
|
|
||||||
"ignore": ["[email protected]", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
|
"ignore": ["[email protected]", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
|
||||||
|
|
||||||
@@ -1076,29 +1077,29 @@
|
|||||||
|
|
||||||
"levn": ["[email protected]", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],
|
"levn": ["[email protected]", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],
|
||||||
|
|
||||||
"lightningcss": ["[email protected]1.1", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.31.1", "lightningcss-darwin-arm64": "1.31.1", "lightningcss-darwin-x64": "1.31.1", "lightningcss-freebsd-x64": "1.31.1", "lightningcss-linux-arm-gnueabihf": "1.31.1", "lightningcss-linux-arm64-gnu": "1.31.1", "lightningcss-linux-arm64-musl": "1.31.1", "lightningcss-linux-x64-gnu": "1.31.1", "lightningcss-linux-x64-musl": "1.31.1", "lightningcss-win32-arm64-msvc": "1.31.1", "lightningcss-win32-x64-msvc": "1.31.1" } }, "sha512-l51N2r93WmGUye3WuFoN5k10zyvrVs0qfKBhyC5ogUQ6Ew6JUSswh78mbSO+IU3nTWsyOArqPCcShdQSadghBQ=="],
|
"lightningcss": ["[email protected]2.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="],
|
||||||
|
|
||||||
"lightningcss-android-arm64": ["[email protected]1.1", "", { "os": "android", "cpu": "arm64" }, "sha512-HXJF3x8w9nQ4jbXRiNppBCqeZPIAfUo8zE/kOEGbW5NZvGc/K7nMxbhIr+YlFlHW5mpbg/YFPdbnCh1wAXCKFg=="],
|
"lightningcss-android-arm64": ["[email protected]2.0", "", { "os": "android", "cpu": "arm64" }, "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg=="],
|
||||||
|
|
||||||
"lightningcss-darwin-arm64": ["[email protected]1.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-02uTEqf3vIfNMq3h/z2cJfcOXnQ0GRwQrkmPafhueLb2h7mqEidiCzkE4gBMEH65abHRiQvhdcQ+aP0D0g67sg=="],
|
"lightningcss-darwin-arm64": ["[email protected]2.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ=="],
|
||||||
|
|
||||||
"lightningcss-darwin-x64": ["[email protected]1.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-1ObhyoCY+tGxtsz1lSx5NXCj3nirk0Y0kB/g8B8DT+sSx4G9djitg9ejFnjb3gJNWo7qXH4DIy2SUHvpoFwfTA=="],
|
"lightningcss-darwin-x64": ["[email protected]2.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w=="],
|
||||||
|
|
||||||
"lightningcss-freebsd-x64": ["[email protected]1.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-1RINmQKAItO6ISxYgPwszQE1BrsVU5aB45ho6O42mu96UiZBxEXsuQ7cJW4zs4CEodPUioj/QrXW1r9pLUM74A=="],
|
"lightningcss-freebsd-x64": ["[email protected]2.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig=="],
|
||||||
|
|
||||||
"lightningcss-linux-arm-gnueabihf": ["[email protected]1.1", "", { "os": "linux", "cpu": "arm" }, "sha512-OOCm2//MZJ87CdDK62rZIu+aw9gBv4azMJuA8/KB74wmfS3lnC4yoPHm0uXZ/dvNNHmnZnB8XLAZzObeG0nS1g=="],
|
"lightningcss-linux-arm-gnueabihf": ["[email protected]2.0", "", { "os": "linux", "cpu": "arm" }, "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw=="],
|
||||||
|
|
||||||
"lightningcss-linux-arm64-gnu": ["[email protected]1.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-WKyLWztD71rTnou4xAD5kQT+982wvca7E6QoLpoawZ1gP9JM0GJj4Tp5jMUh9B3AitHbRZ2/H3W5xQmdEOUlLg=="],
|
"lightningcss-linux-arm64-gnu": ["[email protected]2.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ=="],
|
||||||
|
|
||||||
"lightningcss-linux-arm64-musl": ["[email protected]1.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-mVZ7Pg2zIbe3XlNbZJdjs86YViQFoJSpc41CbVmKBPiGmC4YrfeOyz65ms2qpAobVd7WQsbW4PdsSJEMymyIMg=="],
|
"lightningcss-linux-arm64-musl": ["[email protected]2.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg=="],
|
||||||
|
|
||||||
"lightningcss-linux-x64-gnu": ["[email protected]1.1", "", { "os": "linux", "cpu": "x64" }, "sha512-xGlFWRMl+0KvUhgySdIaReQdB4FNudfUTARn7q0hh/V67PVGCs3ADFjw+6++kG1RNd0zdGRlEKa+T13/tQjPMA=="],
|
"lightningcss-linux-x64-gnu": ["[email protected]2.0", "", { "os": "linux", "cpu": "x64" }, "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA=="],
|
||||||
|
|
||||||
"lightningcss-linux-x64-musl": ["[email protected]1.1", "", { "os": "linux", "cpu": "x64" }, "sha512-eowF8PrKHw9LpoZii5tdZwnBcYDxRw2rRCyvAXLi34iyeYfqCQNA9rmUM0ce62NlPhCvof1+9ivRaTY6pSKDaA=="],
|
"lightningcss-linux-x64-musl": ["[email protected]2.0", "", { "os": "linux", "cpu": "x64" }, "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg=="],
|
||||||
|
|
||||||
"lightningcss-win32-arm64-msvc": ["[email protected]1.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-aJReEbSEQzx1uBlQizAOBSjcmr9dCdL3XuC/6HLXAxmtErsj2ICo5yYggg1qOODQMtnjNQv2UHb9NpOuFtYe4w=="],
|
"lightningcss-win32-arm64-msvc": ["[email protected]2.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw=="],
|
||||||
|
|
||||||
"lightningcss-win32-x64-msvc": ["[email protected]1.1", "", { "os": "win32", "cpu": "x64" }, "sha512-I9aiFrbd7oYHwlnQDqr1Roz+fTz61oDDJX7n9tYF9FJymH1cIN1DtKw3iYt6b8WZgEjoNwVSncwF4wx/ZedMhw=="],
|
"lightningcss-win32-x64-msvc": ["[email protected]2.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q=="],
|
||||||
|
|
||||||
"lines-and-columns": ["[email protected]", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="],
|
"lines-and-columns": ["[email protected]", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="],
|
||||||
|
|
||||||
@@ -1154,11 +1155,11 @@
|
|||||||
|
|
||||||
"negotiator": ["[email protected]", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
|
"negotiator": ["[email protected]", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
|
||||||
|
|
||||||
"next": ["next@16.1.6", "", { "dependencies": { "@next/env": "16.1.6", "@swc/helpers": "0.5.15", "baseline-browser-mapping": "^2.8.3", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.1.6", "@next/swc-darwin-x64": "16.1.6", "@next/swc-linux-arm64-gnu": "16.1.6", "@next/swc-linux-arm64-musl": "16.1.6", "@next/swc-linux-x64-gnu": "16.1.6", "@next/swc-linux-x64-musl": "16.1.6", "@next/swc-win32-arm64-msvc": "16.1.6", "@next/swc-win32-x64-msvc": "16.1.6", "sharp": "^0.34.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw=="],
|
"next": ["next@16.2.3", "", { "dependencies": { "@next/env": "16.2.3", "@swc/helpers": "0.5.15", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.2.3", "@next/swc-darwin-x64": "16.2.3", "@next/swc-linux-arm64-gnu": "16.2.3", "@next/swc-linux-arm64-musl": "16.2.3", "@next/swc-linux-x64-gnu": "16.2.3", "@next/swc-linux-x64-musl": "16.2.3", "@next/swc-win32-arm64-msvc": "16.2.3", "@next/swc-win32-x64-msvc": "16.2.3", "sharp": "^0.34.5" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-9V3zV4oZFza3PVev5/poB9g0dEafVcgNyQ8eTRop8GvxZjV2G15FC5ARuG1eFD42QgeYkzJBJzHghNP8Ad9xtA=="],
|
||||||
|
|
||||||
"next-intl": ["next-intl@4.8.3", "", { "dependencies": { "@formatjs/intl-localematcher": "^0.8.1", "@parcel/watcher": "^2.4.1", "@swc/core": "^1.15.2", "icu-minify": "^4.8.3", "negotiator": "^1.0.0", "next-intl-swc-plugin-extractor": "^4.8.3", "po-parser": "^2.1.1", "use-intl": "^4.8.3" }, "peerDependencies": { "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0", "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-PvdBDWg+Leh7BR7GJUQbCDVVaBRn37GwDBWc9sv0rVQOJDQ5JU1rVzx9EEGuOGYo0DHAl70++9LQ7HxTawdL7w=="],
|
"next-intl": ["next-intl@4.9.1", "", { "dependencies": { "@formatjs/intl-localematcher": "^0.8.1", "@parcel/watcher": "^2.4.1", "@swc/core": "^1.15.2", "icu-minify": "^4.9.1", "negotiator": "^1.0.0", "next-intl-swc-plugin-extractor": "^4.9.1", "po-parser": "^2.1.1", "use-intl": "^4.9.1" }, "peerDependencies": { "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0" } }, "sha512-N7ga0CjtYcdxNvaKNIi6eJ2mmatlHK5hp8rt0YO2Omoc1m0gean242/Ukdj6+gJNiReBVcYIjK0HZeNx7CV1ug=="],
|
||||||
|
|
||||||
"next-intl-swc-plugin-extractor": ["next-intl-swc-plugin-extractor@4.8.3", "", {}, "sha512-YcaT+R9z69XkGhpDarVFWUprrCMbxgIQYPUaXoE6LGVnLjGdo8hu3gL6bramDVjNKViYY8a/pXPy7Bna0mXORg=="],
|
"next-intl-swc-plugin-extractor": ["next-intl-swc-plugin-extractor@4.9.1", "", {}, "sha512-8whJJ6oxJz8JqkHarggmmuEDyXgC7nEnaPhZD91CJwEWW4xp0AST3Mw17YxvHyP2vAF3taWfFbs1maD+WWtz3w=="],
|
||||||
|
|
||||||
"next-themes": ["[email protected]", "", { "peerDependencies": { "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA=="],
|
"next-themes": ["[email protected]", "", { "peerDependencies": { "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA=="],
|
||||||
|
|
||||||
@@ -1276,7 +1277,7 @@
|
|||||||
|
|
||||||
"react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.3" } }, "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg=="],
|
"react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.3" } }, "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg=="],
|
||||||
|
|
||||||
"react-hook-form": ["[email protected]1.2", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-1CHvcDYzuRUNOflt4MOq3ZM46AronNJtQ1S7tnX6YN4y72qhgiUItpacZUAQ0TyWYci3yz1X+rXaSxiuEm86PA=="],
|
"react-hook-form": ["[email protected]2.1", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-RhwBoy2ygeVZje+C+bwJ8g0NjTdBmDlJvAUHTxRjTmSUKPYsKfMphkS2sgEMotsY03bP358yEYlnUeZy//D9Ig=="],
|
||||||
|
|
||||||
"react-is": ["[email protected]", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="],
|
"react-is": ["[email protected]", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="],
|
||||||
|
|
||||||
@@ -1408,7 +1409,7 @@
|
|||||||
|
|
||||||
"tailwind-merge": ["[email protected]", "", {}, "sha512-I8K9wewnVDkL1NTGoqWmVEIlUcB9gFriAEkXkfCjX5ib8ezGxtR3xD7iZIxrfArjEsH7F1CHD4RFUtxefdqV/A=="],
|
"tailwind-merge": ["[email protected]", "", {}, "sha512-I8K9wewnVDkL1NTGoqWmVEIlUcB9gFriAEkXkfCjX5ib8ezGxtR3xD7iZIxrfArjEsH7F1CHD4RFUtxefdqV/A=="],
|
||||||
|
|
||||||
"tailwindcss": ["[email protected].1", "", {}, "sha512-/tBrSQ36vCleJkAOsy9kbNTgaxvGbyOamC30PRePTQe/o1MFwEKHQk4Cn7BNGaPtjp+PuUrByJehM1hgxfq4sw=="],
|
"tailwindcss": ["[email protected].2", "", {}, "sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q=="],
|
||||||
|
|
||||||
"tapable": ["[email protected]", "", {}, "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg=="],
|
"tapable": ["[email protected]", "", {}, "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg=="],
|
||||||
|
|
||||||
@@ -1476,7 +1477,7 @@
|
|||||||
|
|
||||||
"use-callback-ref": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg=="],
|
"use-callback-ref": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg=="],
|
||||||
|
|
||||||
"use-intl": ["use-intl@4.8.3", "", { "dependencies": { "@formatjs/fast-memoize": "^3.1.0", "@schummar/icu-type-parser": "1.21.5", "icu-minify": "^4.8.3", "intl-messageformat": "^11.1.0" }, "peerDependencies": { "react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0" } }, "sha512-nLxlC/RH+le6g3amA508Itnn/00mE+J22ui21QhOWo5V9hCEC43+WtnRAITbJW0ztVZphev5X9gvOf2/Dk9PLA=="],
|
"use-intl": ["use-intl@4.9.1", "", { "dependencies": { "@formatjs/fast-memoize": "^3.1.0", "@schummar/icu-type-parser": "1.21.5", "icu-minify": "^4.9.1", "intl-messageformat": "^11.1.0" }, "peerDependencies": { "react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0" } }, "sha512-iGVV/xFYlhe3btafRlL8RPLD2Jsuet4yqn9DR6LWWbMhULsJnXgLonDkzDmsAIBIwFtk02oJuX/Ox2vwHKF+UQ=="],
|
||||||
|
|
||||||
"use-sidecar": ["[email protected]", "", { "dependencies": { "detect-node-es": "^1.1.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ=="],
|
"use-sidecar": ["[email protected]", "", { "dependencies": { "detect-node-es": "^1.1.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ=="],
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,9 @@
|
|||||||
"revocationError": "Failed to revoke access"
|
"revocationError": "Failed to revoke access"
|
||||||
},
|
},
|
||||||
"positions": {
|
"positions": {
|
||||||
"title": "Positions"
|
"title": "Positions",
|
||||||
|
"loading": "Loading positions...",
|
||||||
|
"empty": "No positions assigned"
|
||||||
},
|
},
|
||||||
"admin": {
|
"admin": {
|
||||||
"title": "Administration",
|
"title": "Administration",
|
||||||
@@ -167,7 +169,35 @@
|
|||||||
"delete": {
|
"delete": {
|
||||||
"success": "Position successfully deleted!",
|
"success": "Position successfully deleted!",
|
||||||
"error": "Failed to delete position"
|
"error": "Failed to delete position"
|
||||||
|
},
|
||||||
|
"permissions": {
|
||||||
|
"label": "Permissions",
|
||||||
|
"empty": "There are no permissions yet"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"userPositions": {
|
||||||
|
"title": "User positions",
|
||||||
|
"subtitle": "Assign and revoke positions for users.",
|
||||||
|
"empty": "There're no users yet",
|
||||||
|
"noPositions": "No positions",
|
||||||
|
"columns": {
|
||||||
|
"user": "User",
|
||||||
|
"positions": "Positions",
|
||||||
|
"actions": "Actions"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"assign": "Assign",
|
||||||
|
"revoke": "Revoke"
|
||||||
|
},
|
||||||
|
"assign": {
|
||||||
|
"success": "Position assigned successfully!",
|
||||||
|
"error": "Failed to assign position"
|
||||||
|
},
|
||||||
|
"revoke": {
|
||||||
|
"success": "Position revoked successfully!",
|
||||||
|
"error": "Failed to revoke position"
|
||||||
|
},
|
||||||
|
"loadError": "Failed to load users"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"logout": "Logout"
|
"logout": "Logout"
|
||||||
@@ -191,12 +221,6 @@
|
|||||||
"dark": "Dark",
|
"dark": "Dark",
|
||||||
"system": "System"
|
"system": "System"
|
||||||
},
|
},
|
||||||
"permissions": {
|
|
||||||
"positions": {
|
|
||||||
"manage": "Create and edit positions",
|
|
||||||
"assign": "Assign positions to users"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"errors": {
|
"errors": {
|
||||||
"serverError": "Server error. Please try again later.",
|
"serverError": "Server error. Please try again later.",
|
||||||
"invalidCredentialsError": "Incorrect email or password",
|
"invalidCredentialsError": "Incorrect email or password",
|
||||||
|
|||||||
@@ -83,7 +83,9 @@
|
|||||||
"revocationError": "Impossibile revocare l'accesso all'applicazione"
|
"revocationError": "Impossibile revocare l'accesso all'applicazione"
|
||||||
},
|
},
|
||||||
"positions": {
|
"positions": {
|
||||||
"title": "Posizioni"
|
"title": "Posizioni",
|
||||||
|
"loading": "Caricamento posizioni...",
|
||||||
|
"empty": "Nessuna posizione assegnata"
|
||||||
},
|
},
|
||||||
"admin": {
|
"admin": {
|
||||||
"title": "Amministrazione",
|
"title": "Amministrazione",
|
||||||
@@ -167,7 +169,35 @@
|
|||||||
"delete": {
|
"delete": {
|
||||||
"success": "La posizione è stata eliminata con successo!",
|
"success": "La posizione è stata eliminata con successo!",
|
||||||
"error": "Impossibile eliminare la posizione"
|
"error": "Impossibile eliminare la posizione"
|
||||||
|
},
|
||||||
|
"permissions": {
|
||||||
|
"label": "Permessi",
|
||||||
|
"empty": "Non ci sono permessi"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"userPositions": {
|
||||||
|
"title": "Posizioni utenti",
|
||||||
|
"subtitle": "Assegna e revoca posizioni agli utenti.",
|
||||||
|
"empty": "Non ci sono utenti",
|
||||||
|
"noPositions": "Nessuna posizione",
|
||||||
|
"columns": {
|
||||||
|
"user": "Utente",
|
||||||
|
"positions": "Posizioni",
|
||||||
|
"actions": "Azioni"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"assign": "Assegna",
|
||||||
|
"revoke": "Revoca"
|
||||||
|
},
|
||||||
|
"assign": {
|
||||||
|
"success": "Posizione assegnata con successo!",
|
||||||
|
"error": "Impossibile assegnare la posizione"
|
||||||
|
},
|
||||||
|
"revoke": {
|
||||||
|
"success": "Posizione revocata con successo!",
|
||||||
|
"error": "Impossibile revocare la posizione"
|
||||||
|
},
|
||||||
|
"loadError": "Impossibile caricare gli utenti"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"logout": "Esci"
|
"logout": "Esci"
|
||||||
@@ -191,12 +221,6 @@
|
|||||||
"dark": "Scuro",
|
"dark": "Scuro",
|
||||||
"system": "Sistema"
|
"system": "Sistema"
|
||||||
},
|
},
|
||||||
"permissions": {
|
|
||||||
"positions": {
|
|
||||||
"manage": "Crea e modifica posizioni",
|
|
||||||
"assign": "Assegna posizioni agli utenti"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"errors": {
|
"errors": {
|
||||||
"serverError": "Errore del server. Riprova più tardi.",
|
"serverError": "Errore del server. Riprova più tardi.",
|
||||||
"invalidCredentialsError": "Email o password non corretti",
|
"invalidCredentialsError": "Email o password non corretti",
|
||||||
|
|||||||
@@ -83,7 +83,9 @@
|
|||||||
"revocationError": "Не удалось отозвать доступ приложения"
|
"revocationError": "Не удалось отозвать доступ приложения"
|
||||||
},
|
},
|
||||||
"positions": {
|
"positions": {
|
||||||
"title": "Должности"
|
"title": "Должности",
|
||||||
|
"loading": "Загрузка должностей...",
|
||||||
|
"empty": "Нет назначенных должностей"
|
||||||
},
|
},
|
||||||
"admin": {
|
"admin": {
|
||||||
"title": "Администрирование",
|
"title": "Администрирование",
|
||||||
@@ -167,7 +169,35 @@
|
|||||||
"delete": {
|
"delete": {
|
||||||
"success": "Должность успешно удалена!",
|
"success": "Должность успешно удалена!",
|
||||||
"error": "Не удалось удалить должность"
|
"error": "Не удалось удалить должность"
|
||||||
|
},
|
||||||
|
"permissions": {
|
||||||
|
"label": "Разрешения",
|
||||||
|
"empty": "Разрешений пока нет"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"userPositions": {
|
||||||
|
"title": "Должности пользователей",
|
||||||
|
"subtitle": "Назначайте и отзывайте должности у пользователей.",
|
||||||
|
"empty": "Пользователей пока нет",
|
||||||
|
"noPositions": "Нет должностей",
|
||||||
|
"columns": {
|
||||||
|
"user": "Пользователь",
|
||||||
|
"positions": "Должности",
|
||||||
|
"actions": "Действия"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"assign": "Назначить",
|
||||||
|
"revoke": "Отозвать"
|
||||||
|
},
|
||||||
|
"assign": {
|
||||||
|
"success": "Должность успешно назначена!",
|
||||||
|
"error": "Не удалось назначить должность"
|
||||||
|
},
|
||||||
|
"revoke": {
|
||||||
|
"success": "Должность успешно отозвана!",
|
||||||
|
"error": "Не удалось отозвать должность"
|
||||||
|
},
|
||||||
|
"loadError": "Не удалось загрузить пользователей"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"logout": "Выйти"
|
"logout": "Выйти"
|
||||||
@@ -191,12 +221,6 @@
|
|||||||
"dark": "Тёмная",
|
"dark": "Тёмная",
|
||||||
"system": "Как в системе"
|
"system": "Как в системе"
|
||||||
},
|
},
|
||||||
"permissions": {
|
|
||||||
"positions": {
|
|
||||||
"manage": "Создание и редактирование должностей",
|
|
||||||
"assign": "Назначение должностей пользователям"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"errors": {
|
"errors": {
|
||||||
"serverError": "Ошибка сервера. Пожалуйста, попробуйте ещё раз позже.",
|
"serverError": "Ошибка сервера. Пожалуйста, попробуйте ещё раз позже.",
|
||||||
"invalidCredentialsError": "Неправильный адрес почты или пароль",
|
"invalidCredentialsError": "Неправильный адрес почты или пароль",
|
||||||
|
|||||||
@@ -13,28 +13,28 @@
|
|||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"lucide-react": "^0.575.0",
|
"lucide-react": "^0.575.0",
|
||||||
"next": "16.1.6",
|
"next": "^16.2.3",
|
||||||
"next-intl": "^4.8.3",
|
"next-intl": "^4.9.1",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"radix-ui": "^1.4.3",
|
"radix-ui": "^1.4.3",
|
||||||
"react": "19.2.3",
|
"react": "19.2.3",
|
||||||
"react-day-picker": "^9.14.0",
|
"react-day-picker": "^9.14.0",
|
||||||
"react-dom": "19.2.3",
|
"react-dom": "19.2.3",
|
||||||
"react-hook-form": "^7.71.2",
|
"react-hook-form": "^7.72.1",
|
||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.5.0"
|
"tailwind-merge": "^3.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4.2.2",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20.19.39",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19.2.14",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19.2.3",
|
||||||
"eslint": "^9",
|
"eslint": "^9.39.4",
|
||||||
"eslint-config-next": "16.1.6",
|
"eslint-config-next": "16.1.6",
|
||||||
"shadcn": "^3.8.5",
|
"shadcn": "^3.8.5",
|
||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4.2.2",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"typescript": "^5"
|
"typescript": "^5.9.3"
|
||||||
},
|
},
|
||||||
"ignoreScripts": [
|
"ignoreScripts": [
|
||||||
"sharp",
|
"sharp",
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export interface Consent {
|
|||||||
export interface Permission {
|
export interface Permission {
|
||||||
id: string;
|
id: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
}
|
}
|
||||||
@@ -47,8 +48,81 @@ export interface Position {
|
|||||||
permissions: Permission[];
|
permissions: Permission[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AdminUser {
|
||||||
|
id: string;
|
||||||
|
email: string;
|
||||||
|
first_name: string;
|
||||||
|
second_name: string;
|
||||||
|
is_admin: boolean;
|
||||||
|
positions: Position[];
|
||||||
|
}
|
||||||
|
|
||||||
export const localeMap = {
|
export const localeMap = {
|
||||||
ru,
|
ru,
|
||||||
en: enUS,
|
en: enUS,
|
||||||
it,
|
it,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface Region {
|
||||||
|
id: string;
|
||||||
|
code: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type FieldType = "text" | "date" | "select" | "masked"
|
||||||
|
|
||||||
|
export interface FieldOption {
|
||||||
|
value: string;
|
||||||
|
label: { en: string; ru: string };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FieldTemplate {
|
||||||
|
id: string;
|
||||||
|
name: { en: string; ru: string };
|
||||||
|
type: FieldType;
|
||||||
|
required?: boolean;
|
||||||
|
mask?: string;
|
||||||
|
options?: FieldOption[];
|
||||||
|
generated?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DocumentType {
|
||||||
|
id: string;
|
||||||
|
code: string;
|
||||||
|
color: string;
|
||||||
|
fields: FieldTemplate[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DocumentApplicationStatus = "pending" | "approved" | "rejected"
|
||||||
|
|
||||||
|
export interface DocumentApplication {
|
||||||
|
id: string;
|
||||||
|
userId: string;
|
||||||
|
documentTypeId: string;
|
||||||
|
documentType: DocumentType;
|
||||||
|
status: DocumentApplicationStatus;
|
||||||
|
reviewedBy?: string;
|
||||||
|
reviewedAt?: string;
|
||||||
|
rejectReason?: string;
|
||||||
|
data: Record<string, string>;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DocumentStatus = "active" | "revoked"
|
||||||
|
|
||||||
|
export interface Document {
|
||||||
|
id: string;
|
||||||
|
userId: string;
|
||||||
|
documentTypeId: string;
|
||||||
|
documentType: DocumentType;
|
||||||
|
applicationId: string;
|
||||||
|
number: string;
|
||||||
|
issuedAt: string;
|
||||||
|
revokedAt?: string | null;
|
||||||
|
revokedBy?: string | null;
|
||||||
|
photo_url?: string | null;
|
||||||
|
data: Record<string, string>;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user