## Move editor under `frontend/editor/`
Pure restructure: `frontend/` becomes the workspace, `frontend/editor/`
holds
the PDF editor. 1775 file renames + 40 wiring edits. No logic changes.
### Why
`frontend/` is currently the editor — its `src/`, `public/`,
`src-tauri/`,
config files all sit at the root. Promoting `frontend/` to a
workspace and putting the editor in a sibling folder leaves room for
future
apps to drop in alongside it, sharing one `package.json` /
`node_modules` /
lint config / Storybook.
### What moves
frontend/
├── editor/ ← NEW: everything editor-specific
│ ├── src/ ← was frontend/src/
│ ├── public/ ← was frontend/public/
│ ├── src-tauri/ ← was frontend/src-tauri/
│ ├── index.html, vite.config.ts, vitest.config.ts, playwright.config.ts
│ ├── tsconfig*.json, tailwind.config.js, postcss.config.js
│ ├── scripts/
│ ├── .env, .env.desktop, .env.saas
│ └── DeveloperGuide.md
├── package.json, package-lock.json, node_modules/ ← workspace install
├── eslint.config.mjs, .prettierrc, .prettierignore ← shared tooling
├── .gitignore
└── README.md
### Wiring edits (40 files)
- `.taskfiles/frontend.yml`, `desktop.yml`, `e2e.yml`
- `build.gradle`, `app/core/build.gradle`
- `eslint.config.mjs`, `frontend/package.json`, `.gitignore`,
`.prettierignore`
- `docker/frontend/Dockerfile`
- 8 `.github/workflows/*.yml`, plus `.github/dependabot.yml`,
`.github/config/.files.yaml`, `.github/labeler-config-srvaroa.yml`
- `scripts/translations/**`
- Docs: `AGENTS.md`, `CLAUDE.md`, `ADDING_TOOLS.md`,
`DeveloperGuide.md`,
`WINDOWS_SIGNING.md`, `devGuide/HowToAddNewLanguage.md`,
`frontend/README.md`,
`frontend/editor/DeveloperGuide.md`
Plus 3 renamed + edited: `editor/vite.config.ts` (env path +
node_modules
walk-up), `editor/scripts/setup-env.mts` (renamed from `.ts` for
`import.meta.url`), `editor/scripts/build-provisioner.mjs` (resolve
src-tauri
relative to script).
### Verification
| Check | Result |
|---|---|
| `task frontend:typecheck:all` (6 variants) | exit 0 |
| `task frontend:lint` (eslint + dpdm) | exit 0 |
| `task frontend:format:check` | exit 0 |
| `task frontend:test` | 657 tests pass, 50 files |
| `task frontend:build:{core,proprietary,saas,desktop,prototypes}` | all
green |
| `task desktop:build` | full Tauri pipeline →
`Stirling-PDF_2.11.0_x64_en-US.msi` |
| `playwright test --list --project=stubbed` | 172 tests discovered |
`task desktop:build` exercises the heaviest path — Rust + WiX + MSI
bundle
against the moved `editor/src-tauri/`. If anything in the restructure
was
wrong it wouldn't have built.
### Test plan
- [ ] `frontend-validation.yml` green
- [ ] `e2e-stubbed.yml` green
- [ ] `tauri-build.yml` green on at least one platform
- [ ] `check_toml.yml` runs on a translation-touching PR
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
124 lines
3.0 KiB
TypeScript
124 lines
3.0 KiB
TypeScript
import apiClient from "@app/services/apiClient";
|
|
import type { User } from "@app/services/userManagementService";
|
|
|
|
export interface Team {
|
|
id: number;
|
|
name: string;
|
|
userCount?: number;
|
|
}
|
|
|
|
export interface TeamMember {
|
|
id: number;
|
|
username: string;
|
|
email?: string;
|
|
roleName: string;
|
|
enabled: boolean;
|
|
team?: {
|
|
id: number;
|
|
name: string;
|
|
};
|
|
lastRequest?: Date | null;
|
|
}
|
|
|
|
export interface TeamDetailsResponse {
|
|
team: Team;
|
|
members: TeamMember[];
|
|
availableUsers: TeamMember[];
|
|
}
|
|
|
|
export interface TeamDetailsUIResponse {
|
|
team: Team;
|
|
teamUsers: User[];
|
|
availableUsers: User[];
|
|
userLastRequest?: Record<string, number>;
|
|
}
|
|
|
|
/**
|
|
* Team Management Service
|
|
* Provides functions to interact with team-related backend APIs
|
|
*/
|
|
export const teamService = {
|
|
/**
|
|
* Get all teams with user counts
|
|
*/
|
|
async getTeams(): Promise<Team[]> {
|
|
const response = await apiClient.get<{ teamsWithCounts: Team[] }>(
|
|
"/api/v1/proprietary/ui-data/teams",
|
|
);
|
|
return response.data.teamsWithCounts;
|
|
},
|
|
|
|
/**
|
|
* Get team details including members
|
|
*/
|
|
async getTeamDetails(teamId: number): Promise<TeamDetailsUIResponse> {
|
|
const response = await apiClient.get<TeamDetailsUIResponse>(
|
|
`/api/v1/proprietary/ui-data/teams/${teamId}`,
|
|
);
|
|
return response.data;
|
|
},
|
|
|
|
/**
|
|
* Create a new team
|
|
*/
|
|
async createTeam(name: string): Promise<void> {
|
|
const formData = new FormData();
|
|
formData.append("name", name);
|
|
await apiClient.post("/api/v1/team/create", formData, {
|
|
suppressErrorToast: true,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* Rename an existing team
|
|
*/
|
|
async renameTeam(teamId: number, newName: string): Promise<void> {
|
|
const formData = new FormData();
|
|
formData.append("teamId", teamId.toString());
|
|
formData.append("newName", newName);
|
|
await apiClient.post("/api/v1/team/rename", formData, {
|
|
suppressErrorToast: true,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* Delete a team (only if it has no members)
|
|
*/
|
|
async deleteTeam(teamId: number): Promise<void> {
|
|
const formData = new FormData();
|
|
formData.append("teamId", teamId.toString());
|
|
await apiClient.post("/api/v1/team/delete", formData, {
|
|
suppressErrorToast: true,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* Add a user to a team
|
|
*/
|
|
async addUserToTeam(teamId: number, userId: number): Promise<void> {
|
|
const formData = new FormData();
|
|
formData.append("teamId", teamId.toString());
|
|
formData.append("userId", userId.toString());
|
|
await apiClient.post("/api/v1/team/addUser", formData, {
|
|
suppressErrorToast: true,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* Move a user to a specific team (used when "removing" from a team - moves to Default)
|
|
*/
|
|
async moveUserToTeam(
|
|
username: string,
|
|
currentRole: string,
|
|
teamId: number,
|
|
): Promise<void> {
|
|
const formData = new FormData();
|
|
formData.append("username", username);
|
|
formData.append("role", currentRole);
|
|
formData.append("teamId", teamId.toString());
|
|
await apiClient.post("/api/v1/user/admin/changeRole", formData, {
|
|
suppressErrorToast: true,
|
|
});
|
|
},
|
|
};
|