feat(chat,files): salon par dossier, favoris, cloisonnement des droits admin (#8)
CD — Déploiement / deploy (push) Successful in 19s
CD — Déploiement / deploy (push) Successful in 19s
- chat: salon attache a un dossier, membres = comptes ayant acces au dossier - securite: suppression du passage automatique admin sur fichiers/dossiers/ corbeille/recherche/galerie/chat ; l'admin n'accede qu'a ses partages - favoris: tri en tete dans l'explorateur + page dediee (GET /favorites) - ui: retrait des pastilles Systeme/Public sur la carte dossier - migration 007_chat : table chat_messages --------- Co-authored-by: xEsiah <[email protected]> Reviewed-on: #8 Reviewed-by: Esiah <[email protected]> Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #8.
This commit is contained in:
@@ -39,6 +39,10 @@ export interface UploadedFile {
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface FavoriteFile extends UploadedFile {
|
||||
folder_name: string | null;
|
||||
}
|
||||
|
||||
export interface FolderPermission {
|
||||
user_id: string;
|
||||
email: string;
|
||||
@@ -145,6 +149,28 @@ export interface AuditEntry {
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ChatMember {
|
||||
id: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
role_slug: string;
|
||||
has_avatar: boolean;
|
||||
avatar_updated_at: string | null;
|
||||
last_login_at: string | null;
|
||||
is_self: boolean;
|
||||
}
|
||||
|
||||
export interface ChatMessage {
|
||||
id: number;
|
||||
user_id: string | null;
|
||||
first_name: string | null;
|
||||
last_name: string | null;
|
||||
body: string;
|
||||
created_at: string;
|
||||
has_avatar: boolean;
|
||||
avatar_updated_at: string | null;
|
||||
}
|
||||
|
||||
export class ApiError extends Error {
|
||||
readonly status: number;
|
||||
|
||||
@@ -291,6 +317,7 @@ export const api = {
|
||||
post<{ file: UploadedFile }>(`/files/${encodeURIComponent(id)}/move`, { folderId }),
|
||||
starFile: (id: string) =>
|
||||
request<{ file: UploadedFile }>(`/files/${encodeURIComponent(id)}/star`, { method: "PUT" }),
|
||||
favorites: () => request<{ files: FavoriteFile[] }>("/favorites"),
|
||||
deleteFile: (id: string) => del<{ ok: boolean }>(`/files/${encodeURIComponent(id)}`),
|
||||
downloadUrl: (id: string) => `${BASE}/files/${encodeURIComponent(id)}/download`,
|
||||
thumbnailUrl: (id: string) => `${BASE}/files/${encodeURIComponent(id)}/thumbnail`,
|
||||
@@ -314,6 +341,18 @@ export const api = {
|
||||
`/media${query({ kind, limit, offset })}`,
|
||||
),
|
||||
|
||||
// --- Chat d'un dossier ------------------------------------------------
|
||||
chatMembers: (folderId: string) =>
|
||||
request<{ members: ChatMember[] }>(`/folders/${encodeURIComponent(folderId)}/chat/members`),
|
||||
chatMessages: (folderId: string, after = 0, limit = 50) =>
|
||||
request<{ messages: ChatMessage[] }>(
|
||||
`/folders/${encodeURIComponent(folderId)}/chat/messages${query({ after, limit })}`,
|
||||
),
|
||||
chatSend: (folderId: string, body: string) =>
|
||||
post<{ message: ChatMessage }>(`/folders/${encodeURIComponent(folderId)}/chat/messages`, { body }),
|
||||
chatDeleteMessage: (folderId: string, id: number) =>
|
||||
del<{ ok: boolean }>(`/folders/${encodeURIComponent(folderId)}/chat/messages/${id}`),
|
||||
|
||||
// --- Administration ----------------------------------------------------
|
||||
adminStats: () => request<AdminStats>("/admin/stats"),
|
||||
adminUsers: (q?: string) =>
|
||||
|
||||
Reference in New Issue
Block a user