diff --git a/src/app/features/issue/issue.model.ts b/src/app/features/issue/issue.model.ts index 266909727..dfb36ec8c 100644 --- a/src/app/features/issue/issue.model.ts +++ b/src/app/features/issue/issue.model.ts @@ -85,32 +85,32 @@ export type IssueData = | RedmineIssue; export type IssueDataReduced = - | GithubIssueReduced - | JiraIssueReduced - | GitlabIssue - | OpenProjectWorkPackageReduced - | CaldavIssueReduced - | ICalIssueReduced - | GiteaIssue - | RedmineIssue; + | (GithubIssueReduced & { plannedAt?: string | null }) + | (JiraIssueReduced & { plannedAt?: string | null }) + | (GitlabIssue & { plannedAt?: string | null }) + | (OpenProjectWorkPackageReduced & { plannedAt?: string | null }) + | (CaldavIssueReduced & { plannedAt?: string | null }) + | (ICalIssueReduced & { plannedAt?: string | null }) + | (GiteaIssue & { plannedAt?: string | null }) + | (RedmineIssue & { plannedAt?: string | null }); export type IssueDataReducedMap = { [K in IssueProviderKey]: K extends 'JIRA' - ? JiraIssueReduced + ? JiraIssueReduced & { plannedAt?: string | null } : K extends 'GITHUB' - ? GithubIssueReduced + ? GithubIssueReduced & { plannedAt?: string | null } : K extends 'GITLAB' - ? GitlabIssue + ? GitlabIssue & { plannedAt?: string | null } : K extends 'CALDAV' - ? CaldavIssueReduced + ? CaldavIssueReduced & { plannedAt?: string | null } : K extends 'ICAL' - ? ICalIssueReduced + ? ICalIssueReduced & { plannedAt?: string | null } : K extends 'OPEN_PROJECT' - ? OpenProjectWorkPackageReduced + ? OpenProjectWorkPackageReduced & { plannedAt?: string | null } : K extends 'GITEA' - ? GiteaIssue + ? GiteaIssue & { plannedAt?: string | null } : K extends 'REDMINE' - ? RedmineIssue + ? RedmineIssue & { plannedAt?: string | null } : never; }; diff --git a/src/app/features/issue/issue.service.ts b/src/app/features/issue/issue.service.ts index fc3c75ad0..0f5692af2 100644 --- a/src/app/features/issue/issue.service.ts +++ b/src/app/features/issue/issue.service.ts @@ -454,12 +454,18 @@ export class IssueService { } }; + const oneDayInMilliseconds = 24 * 60 * 60 * 1000; + const taskData = { issueType: issueProviderKey, issueProviderId: issueProviderId, issueId: issueDataReduced.id.toString(), issueWasUpdated: false, issueLastUpdated: Date.now(), + plannedAt: issueDataReduced.plannedAt + ? new Date(new Date(issueDataReduced.plannedAt).setHours(6, 0, 0, 0)).getTime() + + oneDayInMilliseconds + : null, // Adjust plannedAt to 6 AM or set it to null if not present ...additionalFromProviderIssueService, // NOTE: if we were to add tags, this could be overwritten here ...(await getProjectOrTagId()), diff --git a/src/app/features/issue/providers/open-project/open-project-issue/open-project-issue-map.util.ts b/src/app/features/issue/providers/open-project/open-project-issue/open-project-issue-map.util.ts index 17d3a424a..555251a18 100644 --- a/src/app/features/issue/providers/open-project/open-project-issue/open-project-issue-map.util.ts +++ b/src/app/features/issue/providers/open-project/open-project-issue/open-project-issue-map.util.ts @@ -16,6 +16,7 @@ export const mapOpenProjectIssueReduced = ( ): OpenProjectWorkPackageReduced => { return { ...issue, + plannedAt: issue.startDate, url: `${cfg.host}/projects/${cfg.projectId}/work_packages/${issue.id}`, }; }; diff --git a/src/app/features/issue/providers/open-project/open-project-issue/open-project-issue.model.ts b/src/app/features/issue/providers/open-project/open-project-issue/open-project-issue.model.ts index 7eff78439..2ac290f02 100644 --- a/src/app/features/issue/providers/open-project/open-project-issue/open-project-issue.model.ts +++ b/src/app/features/issue/providers/open-project/open-project-issue/open-project-issue.model.ts @@ -7,6 +7,7 @@ export type OpenProjectWorkPackageReduced = OpenProjectOriginalWorkPackageReduce Readonly<{ // added // transformed + plannedAt: string | null; url: string; // removed }>;