refactor(frontend) : replace any types with concrete TypeScript types
Replace 9 occurrences of 'any' with proper types: HydraCollection, Task, ClientTicketWrite, TimeEntryWrite across 7 components. Ticket: T-023 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -191,7 +191,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ClientTicket } from '~/services/dto/client-ticket'
|
import type { ClientTicket, ClientTicketWrite } from '~/services/dto/client-ticket'
|
||||||
import type { TaskDocument } from '~/services/dto/task-document'
|
import type { TaskDocument } from '~/services/dto/task-document'
|
||||||
import { useTaskDocumentService } from '~/services/task-documents'
|
import { useTaskDocumentService } from '~/services/task-documents'
|
||||||
import { useClientTicketService } from '~/services/client-tickets'
|
import { useClientTicketService } from '~/services/client-tickets'
|
||||||
@@ -243,7 +243,7 @@ const canEdit = computed(() => {
|
|||||||
if (!sub) return false
|
if (!sub) return false
|
||||||
// submittedBy can be an IRI string or an embedded object
|
// submittedBy can be an IRI string or an embedded object
|
||||||
if (typeof sub === 'string') return sub === `/api/users/${userId}`
|
if (typeof sub === 'string') return sub === `/api/users/${userId}`
|
||||||
if (typeof sub === 'object' && 'id' in sub) return (sub as any).id === userId
|
if (typeof sub === 'object' && 'id' in sub) return (sub as { id: number }).id === userId
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ async function saveEdit() {
|
|||||||
if (props.ticket.type === 'bug') {
|
if (props.ticket.type === 'bug') {
|
||||||
data.url = editForm.url || null
|
data.url = editForm.url || null
|
||||||
}
|
}
|
||||||
await clientTicketService.update(props.ticket.id, data as any)
|
await clientTicketService.update(props.ticket.id, data as Partial<ClientTicketWrite>)
|
||||||
isEditing.value = false
|
isEditing.value = false
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ import type { UserData } from '~/services/dto/user-data'
|
|||||||
import type { Project } from '~/services/dto/project'
|
import type { Project } from '~/services/dto/project'
|
||||||
import type { TaskTag } from '~/services/dto/task-tag'
|
import type { TaskTag } from '~/services/dto/task-tag'
|
||||||
import { useAppVersion } from '~/composables/useAppVersion'
|
import { useAppVersion } from '~/composables/useAppVersion'
|
||||||
|
import type { HydraCollection } from '~/utils/api'
|
||||||
import { extractHydraMembers } from '~/utils/api'
|
import { extractHydraMembers } from '~/utils/api'
|
||||||
|
|
||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
@@ -211,9 +212,9 @@ async function loadRefData() {
|
|||||||
if (refData.loaded) return
|
if (refData.loaded) return
|
||||||
const api = useApi()
|
const api = useApi()
|
||||||
const [usersData, projectsData, typesData] = await Promise.all([
|
const [usersData, projectsData, typesData] = await Promise.all([
|
||||||
api.get<any>('/users'),
|
api.get<HydraCollection<UserData>>('/users'),
|
||||||
api.get<any>('/projects'),
|
api.get<HydraCollection<Project>>('/projects'),
|
||||||
api.get<any>('/task_tags'),
|
api.get<HydraCollection<TaskTag>>('/task_tags'),
|
||||||
])
|
])
|
||||||
refData.users = extractHydraMembers(usersData)
|
refData.users = extractHydraMembers(usersData)
|
||||||
refData.projects = extractHydraMembers(projectsData)
|
refData.projects = extractHydraMembers(projectsData)
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ const lineOptions = {
|
|||||||
legend: { display: false },
|
legend: { display: false },
|
||||||
tooltip: {
|
tooltip: {
|
||||||
callbacks: {
|
callbacks: {
|
||||||
label: (ctx: any) => `${formatHours(ctx.raw)}`,
|
label: (ctx: { raw: unknown }) => `${formatHours(ctx.raw as number)}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -480,7 +480,7 @@ const lineOptions = {
|
|||||||
beginAtZero: true,
|
beginAtZero: true,
|
||||||
grid: { color: '#f3f4f6' },
|
grid: { color: '#f3f4f6' },
|
||||||
ticks: {
|
ticks: {
|
||||||
callback: (value: any) => `${value}h`,
|
callback: (value: number | string) => `${value}h`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
x: {
|
x: {
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ import type { UserData } from '~/services/dto/user-data'
|
|||||||
import type { Project } from '~/services/dto/project'
|
import type { Project } from '~/services/dto/project'
|
||||||
import type { TaskTag } from '~/services/dto/task-tag'
|
import type { TaskTag } from '~/services/dto/task-tag'
|
||||||
import { useTimeEntryService } from '~/services/time-entries'
|
import { useTimeEntryService } from '~/services/time-entries'
|
||||||
|
import type { HydraCollection } from '~/utils/api'
|
||||||
import { extractHydraMembers } from '~/utils/api'
|
import { extractHydraMembers } from '~/utils/api'
|
||||||
|
|
||||||
useHead({ title: 'Suivi des temps' })
|
useHead({ title: 'Suivi des temps' })
|
||||||
@@ -308,9 +309,9 @@ async function loadReferenceData() {
|
|||||||
const api = useApi()
|
const api = useApi()
|
||||||
|
|
||||||
const [usersData, projectsData, typesData] = await Promise.all([
|
const [usersData, projectsData, typesData] = await Promise.all([
|
||||||
api.get<any>('/users'),
|
api.get<HydraCollection<UserData>>('/users'),
|
||||||
api.get<any>('/projects'),
|
api.get<HydraCollection<Project>>('/projects'),
|
||||||
api.get<any>('/task_tags'),
|
api.get<HydraCollection<TaskTag>>('/task_tags'),
|
||||||
])
|
])
|
||||||
|
|
||||||
users.value = extractHydraMembers(usersData)
|
users.value = extractHydraMembers(usersData)
|
||||||
|
|||||||
Reference in New Issue
Block a user