CI/CD
This commit is contained in:
+25
-4
@@ -4,7 +4,16 @@
|
||||
|
||||
export * from './client'
|
||||
export * from './types'
|
||||
export * from './services/authService'
|
||||
export {
|
||||
type RequestOTPRequest,
|
||||
type RequestOTPResponse,
|
||||
type VerifyOTPRequest,
|
||||
type AuthUser,
|
||||
type VerifyOTPResponse,
|
||||
type UpdateProfilePayload,
|
||||
type UpdateProfileResponse,
|
||||
authService
|
||||
} from './services/authService'
|
||||
export * from './services/taskService'
|
||||
export * from './services/eventService'
|
||||
export * from './services/simulatorService'
|
||||
@@ -12,8 +21,20 @@ export * from './services/chatService'
|
||||
export * from './services/aiChatService'
|
||||
export * from './services/kanbanService'
|
||||
export * from './services/todoService'
|
||||
export * from './services/userManagementService'
|
||||
export {
|
||||
type User,
|
||||
type UserDetails,
|
||||
type Account,
|
||||
type ApiResponse,
|
||||
type UpdateProfileRequest,
|
||||
type AddAccountRequest,
|
||||
type UpdateAccountRequest,
|
||||
userManagementService
|
||||
} from './services/userManagementService'
|
||||
export * from './services/rolesPermissionsService'
|
||||
export * from './services/sensorHubService'
|
||||
export * from './services/farmDashboardService'
|
||||
|
||||
export {
|
||||
type FarmDashboardConfigResponse,
|
||||
type FarmDashboardCardsResponse,
|
||||
farmDashboardService
|
||||
} from './services/farmDashboardService'
|
||||
|
||||
@@ -6,6 +6,36 @@
|
||||
|
||||
import { apiClient } from '../client'
|
||||
|
||||
export interface User {
|
||||
id: number
|
||||
username: string
|
||||
email: string
|
||||
first_name: string
|
||||
last_name: string
|
||||
phone_number: string
|
||||
role?: string
|
||||
status?: string
|
||||
avatar?: string
|
||||
fullName?: string
|
||||
currentPlan?: string
|
||||
billing?: string
|
||||
company?: string
|
||||
country?: string
|
||||
contact?: string
|
||||
}
|
||||
|
||||
export interface UserDetails {
|
||||
id: number
|
||||
username: string
|
||||
email: string
|
||||
first_name: string
|
||||
last_name: string
|
||||
phone_number: string
|
||||
role?: string
|
||||
status?: string
|
||||
avatar?: string
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
id: number
|
||||
username: string
|
||||
@@ -49,6 +79,31 @@ export interface UpdateAccountRequest {
|
||||
}
|
||||
|
||||
export const userManagementService = {
|
||||
/**
|
||||
* Get list of users
|
||||
*/
|
||||
async getUsers(): Promise<{ users: User[]; stats: { total: number; active: number; pending: number; inactive: number } }> {
|
||||
const response = await apiClient.get<ApiResponse<{ users: User[]; stats: { total: number; active: number; pending: number; inactive: number } }>>('/api/account/')
|
||||
|
||||
return response.data as { users: User[]; stats: { total: number; active: number; pending: number; inactive: number } }
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a single user by ID
|
||||
*/
|
||||
async getUser(id: number): Promise<UserDetails> {
|
||||
const response = await apiClient.get<ApiResponse<UserDetails>>(`/api/account/${id}/`)
|
||||
|
||||
return response.data as unknown as UserDetails
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete a user by ID
|
||||
*/
|
||||
async deleteUser(id: number): Promise<void> {
|
||||
await apiClient.delete<ApiResponse<unknown>>(`/api/account/${id}/`)
|
||||
},
|
||||
|
||||
/**
|
||||
* Update current user profile (first_name, last_name, email)
|
||||
*/
|
||||
|
||||
@@ -10,9 +10,9 @@ import type { BoxProps } from '@mui/material/Box'
|
||||
|
||||
// Third-party Imports
|
||||
import { Calendar } from 'react-multi-date-picker'
|
||||
import type { DateObject } from 'react-multi-date-picker'
|
||||
import DateObject from 'react-date-object'
|
||||
import persian from 'react-date-object/calendars/persian'
|
||||
import fa from 'react-date-object/locales/fa'
|
||||
import persian_fa from 'react-date-object/locales/persian_fa'
|
||||
|
||||
// Styles - base styles only, we override colors via sx
|
||||
import 'react-multi-date-picker/styles/colors/teal.css'
|
||||
@@ -30,23 +30,23 @@ const AppJalaliDatepicker = (props: AppJalaliDatepickerProps) => {
|
||||
const [internalValue, setInternalValue] = useState<DateObject | undefined>(() => {
|
||||
const d = externalValue ?? new Date()
|
||||
|
||||
return new DateObject(d, { calendar: persian, locale: fa })
|
||||
return new DateObject({ date: d, calendar: persian, locale: persian_fa })
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (externalValue != null) {
|
||||
setInternalValue(new DateObject(externalValue, { calendar: persian, locale: fa }))
|
||||
setInternalValue(new DateObject({ date: externalValue, calendar: persian, locale: persian_fa }))
|
||||
}
|
||||
}, [externalValue])
|
||||
|
||||
const handleChange = (d: DateObject | null) => {
|
||||
if (d) {
|
||||
setInternalValue(d)
|
||||
setInternalValue(d as unknown as DateObject)
|
||||
onChange?.(d.toDate())
|
||||
}
|
||||
}
|
||||
|
||||
const displayValue = internalValue ?? new DateObject({ calendar: persian, locale: fa })
|
||||
const displayValue = internalValue ?? new DateObject({ calendar: persian, locale: persian_fa })
|
||||
|
||||
return (
|
||||
<Box
|
||||
@@ -87,9 +87,9 @@ const AppJalaliDatepicker = (props: AppJalaliDatepickerProps) => {
|
||||
>
|
||||
<Calendar
|
||||
value={displayValue}
|
||||
onChange={handleChange}
|
||||
onChange={handleChange as any}
|
||||
calendar={persian}
|
||||
locale={fa}
|
||||
locale={persian_fa}
|
||||
className="teal"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user