refactor: move TaskStatus, TaskPriority, and TaskCategory enums from interface to constants
This commit is contained in:
parent
e4c8fcb7f0
commit
01afbe7926
9 changed files with 33 additions and 50 deletions
|
|
@ -2,13 +2,7 @@ import { CommonModule } from '@angular/common';
|
|||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { FormsModule, NgForm } from '@angular/forms';
|
||||
import { AssignedComponent } from './assigned/assigned.component';
|
||||
import {
|
||||
Subtask,
|
||||
Task,
|
||||
TaskCategory,
|
||||
TaskPriority,
|
||||
TaskStatus,
|
||||
} from '../../interfaces/task.interface';
|
||||
import { Subtask, Task } from '../../interfaces/task.interface';
|
||||
import { OverlayService } from '../../services/overlay.service';
|
||||
import { FormBtnComponent } from '../../shared/components/buttons/form-btn/form-btn.component';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
|
@ -22,11 +16,14 @@ import { HeadlineComponent } from '../../shared/components/headline/headline.com
|
|||
import {
|
||||
PRIORITIES,
|
||||
PRIORITY_LABELS,
|
||||
TaskPriority,
|
||||
} from '../../constants/task-priority.constants';
|
||||
import {
|
||||
CATEGORIES,
|
||||
CATEGORY_LABELS,
|
||||
TaskCategory,
|
||||
} from '../../constants/task-category.constants';
|
||||
import { TaskStatus } from '../../constants/task-status.constants';
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-task',
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@ import { Router } from '@angular/router';
|
|||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TaskHighlightedComponent } from './task/task-highlighted/task-highlighted.component';
|
||||
import { ApiService } from '../../services/api.service';
|
||||
import {
|
||||
Task,
|
||||
TaskMoveEvent,
|
||||
TaskStatus,
|
||||
} from '../../interfaces/task.interface';
|
||||
import { Task, TaskMoveEvent } from '../../interfaces/task.interface';
|
||||
import { TaskService } from '../../services/task.service';
|
||||
import { LoadingSpinnerComponent } from '../../shared/components/loading-spinner/loading-spinner.component';
|
||||
import { debounceTime, finalize, Subject, take, takeUntil } from 'rxjs';
|
||||
|
|
@ -21,7 +17,11 @@ import { UpdateNotifierService } from '../../services/update-notifier.service';
|
|||
import { ToastNotificationService } from '../../services/toast-notification.service';
|
||||
import { ResizeService } from '../../services/resize.service';
|
||||
import { HeadlineComponent } from '../../shared/components/headline/headline.component';
|
||||
import { STATUS_LABELS, STATUSES } from '../../constants/task-status.constants';
|
||||
import {
|
||||
STATUS_LABELS,
|
||||
STATUSES,
|
||||
TaskStatus,
|
||||
} from '../../constants/task-status.constants';
|
||||
import {
|
||||
CATEGORIES,
|
||||
CATEGORY_LABELS,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import {
|
||||
Task,
|
||||
TaskMoveEvent,
|
||||
TaskStatus,
|
||||
} from '../../../../interfaces/task.interface';
|
||||
import { Task, TaskMoveEvent } from '../../../../interfaces/task.interface';
|
||||
import {
|
||||
STATUS_LABELS,
|
||||
STATUSES,
|
||||
TaskStatus,
|
||||
} from '../../../../constants/task-status.constants';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import { TaskCategory } from '../interfaces/task.interface';
|
||||
export enum TaskCategory {
|
||||
USER_STORY = 'User Story',
|
||||
TECHNICAL_TASK = 'Technical Task',
|
||||
}
|
||||
|
||||
export const CATEGORIES: TaskCategory[] = [
|
||||
TaskCategory.USER_STORY,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
import { TaskPriority } from '../interfaces/task.interface';
|
||||
export enum TaskPriority {
|
||||
LOW = 'low',
|
||||
MEDIUM = 'medium',
|
||||
URGENT = 'urgent',
|
||||
}
|
||||
|
||||
export const PRIORITIES: TaskPriority[] = [
|
||||
TaskPriority.LOW,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
import { TaskStatus } from '../interfaces/task.interface';
|
||||
export enum TaskStatus {
|
||||
TODO = 'todo',
|
||||
IN_PROGRESS = 'inProgress',
|
||||
AWAIT_FEEDBACK = 'awaitFeedback',
|
||||
DONE = 'done',
|
||||
}
|
||||
|
||||
export const STATUSES: TaskStatus[] = [
|
||||
TaskStatus.TODO,
|
||||
|
|
|
|||
|
|
@ -1,27 +1,8 @@
|
|||
import { TaskCategory } from '../constants/task-category.constants';
|
||||
import { TaskPriority } from '../constants/task-priority.constants';
|
||||
import { TaskStatus } from '../constants/task-status.constants';
|
||||
import { UserSummary } from './user.interface';
|
||||
|
||||
// Enums
|
||||
|
||||
export enum TaskStatus {
|
||||
TODO = 'todo',
|
||||
IN_PROGRESS = 'inProgress',
|
||||
AWAIT_FEEDBACK = 'awaitFeedback',
|
||||
DONE = 'done',
|
||||
}
|
||||
|
||||
export enum TaskPriority {
|
||||
LOW = 'low',
|
||||
MEDIUM = 'medium',
|
||||
URGENT = 'urgent',
|
||||
}
|
||||
|
||||
export enum TaskCategory {
|
||||
USER_STORY = 'User Story',
|
||||
TECHNICAL_TASK = 'Technical Task',
|
||||
}
|
||||
|
||||
// Interfaces
|
||||
|
||||
export interface Task {
|
||||
id?: string;
|
||||
title: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { Injectable, EventEmitter } from '@angular/core';
|
||||
import { Task, TaskStatus } from '../interfaces/task.interface';
|
||||
import { Task } from '../interfaces/task.interface';
|
||||
import { TaskStatus } from '../constants/task-status.constants';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { ApiService } from './api.service';
|
||||
import {
|
||||
Task,
|
||||
TaskCategory,
|
||||
TaskPriority,
|
||||
TaskStatus,
|
||||
} from '../interfaces/task.interface';
|
||||
import { Task } from '../interfaces/task.interface';
|
||||
import { catchError, map, switchMap } from 'rxjs/operators';
|
||||
import { UserSummary } from '../interfaces/user.interface';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue