2023-10-30 12:17:27 +00:00
|
|
|
import type { Entity as TEntity } from '@strapi/types';
|
|
|
|
|
|
|
|
export interface Entity {
|
|
|
|
id: TEntity.ID;
|
|
|
|
createdAt: string;
|
|
|
|
updatedAt: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Permission extends Entity {
|
|
|
|
action: string;
|
|
|
|
actionParameters: object;
|
|
|
|
subject?: string | null;
|
|
|
|
properties: {
|
|
|
|
fields?: string[];
|
|
|
|
locales?: string[];
|
|
|
|
[key: string]: any;
|
|
|
|
};
|
|
|
|
conditions: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AdminUser extends Entity {
|
|
|
|
firstname?: string;
|
|
|
|
lastname?: string;
|
|
|
|
username?: string;
|
|
|
|
email?: string;
|
|
|
|
password?: string;
|
|
|
|
resetPasswordToken?: string | null;
|
|
|
|
registrationToken?: string | null;
|
|
|
|
isActive: boolean;
|
|
|
|
roles: AdminRole[];
|
|
|
|
blocked: boolean;
|
|
|
|
preferedLanguage?: string;
|
|
|
|
}
|
|
|
|
|
2023-11-21 11:40:51 +00:00
|
|
|
export type AdminUserCreationPayload = Omit<
|
|
|
|
AdminUser,
|
|
|
|
keyof Entity | 'roles' | 'isActive' | 'blocked'
|
|
|
|
> & {
|
2023-11-16 16:38:15 +01:00
|
|
|
roles: TEntity.ID[];
|
|
|
|
};
|
|
|
|
|
2023-11-21 11:40:51 +00:00
|
|
|
export type AdminUserUpdatePayload = Omit<AdminUser, keyof Entity | 'roles'> & {
|
|
|
|
roles: TEntity.ID[];
|
2023-11-16 16:38:15 +01:00
|
|
|
};
|
2023-10-30 12:17:27 +00:00
|
|
|
|
2023-11-21 11:40:51 +00:00
|
|
|
export type SanitizedAdminUser = Omit<AdminUser, 'password' | 'resetPasswordToken' | 'roles'> & {
|
|
|
|
roles: SanitizedAdminRole[];
|
|
|
|
};
|
2023-11-16 16:38:15 +01:00
|
|
|
export interface AdminRole extends Entity {
|
|
|
|
name: string;
|
|
|
|
code: string;
|
|
|
|
description?: string;
|
|
|
|
users: AdminUser[];
|
|
|
|
permissions: Permission[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export type SanitizedAdminRole = Omit<
|
|
|
|
AdminRole,
|
|
|
|
'users' | 'permissions' | 'createdAt' | 'updatedAt'
|
|
|
|
>;
|
2023-11-21 11:40:51 +00:00
|
|
|
|
|
|
|
export interface Pagination {
|
|
|
|
page: number;
|
|
|
|
pageSize: number;
|
|
|
|
pageCount: number;
|
|
|
|
total: number;
|
|
|
|
}
|