cleanup and fix formatting for utils and packages

This commit is contained in:
Gregor Vostrak
2024-08-22 15:43:04 +02:00
parent 1328692faf
commit 249b1b5820
6 changed files with 26 additions and 65 deletions

View File

@@ -1,44 +0,0 @@
import type { ApiOf, ZodiosResponseByAlias, ZodiosBodyByAlias, ZodiosQueryParamsByAlias } from '@zodios/core';
export type SolidTimeApi = ApiOf<typeof api>;
export type InvitationsIndexResponse = ZodiosResponseByAlias<SolidTimeApi, 'getInvitations'>;
export type CreateInvitationBody = ZodiosBodyByAlias<SolidTimeApi, 'invite'>;
export type Invitation = InvitationsIndexResponse['data'][0];
export type TimeEntryResponse = ZodiosResponseByAlias<SolidTimeApi, 'getTimeEntries'>;
export type TimeEntry = TimeEntryResponse['data'][0];
export type CreateTimeEntryBody = ZodiosBodyByAlias<SolidTimeApi, 'createTimeEntry'>;
export type ProjectResponse = ZodiosResponseByAlias<SolidTimeApi, 'getProjects'>;
export type Project = ProjectResponse['data'][0];
export type CreateProjectBody = ZodiosBodyByAlias<SolidTimeApi, 'createProject'>;
export type UpdateProjectBody = ZodiosBodyByAlias<SolidTimeApi, 'updateProject'>;
export type ProjectMemberResponse = ZodiosResponseByAlias<SolidTimeApi, 'getProjectMembers'>;
export type CreateProjectMemberBody = ZodiosBodyByAlias<SolidTimeApi, 'createProjectMember'>;
export type UpdateProjectMemberBody = ZodiosBodyByAlias<SolidTimeApi, 'updateProjectMember'>;
export type ProjectMember = ProjectMemberResponse['data'][0];
export type CreateTaskBody = ZodiosBodyByAlias<SolidTimeApi, 'createTask'>;
export type CreateClientBody = ZodiosBodyByAlias<SolidTimeApi, 'createClient'>;
export type UpdateClientBody = ZodiosBodyByAlias<SolidTimeApi, 'updateClient'>;
export type TagIndexResponse = ZodiosResponseByAlias<SolidTimeApi, 'getTags'>;
export type Tag = TagIndexResponse['data'][0];
export type TaskIndexResponse = ZodiosResponseByAlias<SolidTimeApi, 'getTasks'>;
export type Task = TaskIndexResponse['data'][0];
export type UpdateTaskBody = ZodiosBodyByAlias<SolidTimeApi, 'updateTask'>;
export type ClientIndexResponse = ZodiosResponseByAlias<SolidTimeApi, 'getClients'>;
export type Client = ClientIndexResponse['data'][0];
export type MemberIndexResponse = ZodiosResponseByAlias<SolidTimeApi, 'getMembers'>;
export type Member = MemberIndexResponse['data'][0];
export type UpdateMemberBody = ZodiosBodyByAlias<SolidTimeApi, 'updateMember'>;
export type InviteMemberBody = ZodiosBodyByAlias<SolidTimeApi, 'invite'>;
export type MemberRole = InviteMemberBody['role'];
export type CreateTagBody = ZodiosBodyByAlias<SolidTimeApi, 'createTag'>;
export type ImportType = ZodiosResponseByAlias<SolidTimeApi, 'getImporters'>['data'][0];
export type ImportReport = ZodiosResponseByAlias<SolidTimeApi, 'importData'>;
export type ReportingResponse = ZodiosResponseByAlias<SolidTimeApi, 'getAggregatedTimeEntries'>;
export type AggregatedTimeEntries = ReportingResponse['data'];
export type GroupedDataEntries = ReportingResponse['data']['grouped_data'];
export type AggregatedTimeEntriesQueryParams = ZodiosQueryParamsByAlias<SolidTimeApi, 'getAggregatedTimeEntries'>;
export type OrganizationResponse = ZodiosResponseByAlias<SolidTimeApi, 'getOrganization'>;
export type Organization = ZodiosResponseByAlias<SolidTimeApi, 'getOrganization'>['data'];
export type UpdateOrganizationBody = ZodiosBodyByAlias<SolidTimeApi, 'updateOrganization'>;
export type MyMemberships = ZodiosResponseByAlias<SolidTimeApi, 'getMyMemberships'>['data'];
export type MyMembership = MyMemberships[0];
export declare const api: any;

View File

@@ -1,6 +1,6 @@
import { resolve } from 'path'
import { defineConfig } from 'vite'
import dts from "vite-plugin-dts";
import { resolve } from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
export default defineConfig({
plugins: [dts()],
@@ -13,4 +13,4 @@ export default defineConfig({
fileName: 'solidtime-api',
},
},
})
});

View File

@@ -40,30 +40,38 @@ const props = defineProps<{
}>();
function updateTimeEntryDescription(description: string) {
const updatedTimeEntries = props.timeEntry.timeEntries.map((entry: TimeEntry) => {
return { ...entry, description };
});
const updatedTimeEntries = props.timeEntry.timeEntries.map(
(entry: TimeEntry) => {
return { ...entry, description };
}
);
props.updateTimeEntries(updatedTimeEntries);
}
function updateTimeEntryTags(tags: string[]) {
const updatedTimeEntries = props.timeEntry.timeEntries.map((entry: TimeEntry) => {
return { ...entry, tags };
});
const updatedTimeEntries = props.timeEntry.timeEntries.map(
(entry: TimeEntry) => {
return { ...entry, tags };
}
);
props.updateTimeEntries(updatedTimeEntries);
}
function updateTimeEntryBillable(billable: boolean) {
const updatedTimeEntries = props.timeEntry.timeEntries.map((entry: TimeEntry) => {
return { ...entry, billable };
});
const updatedTimeEntries = props.timeEntry.timeEntries.map(
(entry: TimeEntry) => {
return { ...entry, billable };
}
);
props.updateTimeEntries(updatedTimeEntries);
}
function updateProjectAndTask(projectId: string, taskId: string) {
const updatedTimeEntries = props.timeEntry.timeEntries.map((entry: TimeEntry) => {
return { ...entry, project_id: projectId, task_id: taskId };
});
const updatedTimeEntries = props.timeEntry.timeEntries.map(
(entry: TimeEntry) => {
return { ...entry, project_id: projectId, task_id: taskId };
}
);
props.updateTimeEntries(updatedTimeEntries);
}

View File

@@ -45,5 +45,5 @@ export {
SelectDropdown,
Badge,
Checkbox,
TimeEntryGroupedTable
TimeEntryGroupedTable,
};

View File

@@ -1,7 +1,7 @@
import { defineConfig } from 'vite';
import { resolve } from 'path';
import vue from '@vitejs/plugin-vue';
import dts from "vite-plugin-dts";
import dts from 'vite-plugin-dts';
// https://vitejs.dev/config/
export default defineConfig({

View File

@@ -10,7 +10,6 @@ function getCurrentUserId() {
return page.props.auth.user.id;
}
function getCurrentOrganizationId() {
return page.props.auth.user.current_team_id;
}
@@ -27,8 +26,6 @@ function getCurrentRole() {
)?.membership.role;
}
export {
getCurrentOrganizationId,
getCurrentUserId,