import * as Koa from 'koa' import { Context } from "koa" import { EventEmitter } from 'events' import TaskFactory from './bll/factory/import/task' import TestcaseFactory from './bll/factory/import/testcase' import { Model } from 'mongoose' import { IUTaskModel } from './model/task'; import { IUUserModel } from './model/user'; import { IUScenariofieldconfigModel } from './model/scenariofieldconfig'; import { IUSmartgroupModel } from './model/smartgroup'; import { IUTasklistModel } from './model/tasklist'; import { IUStageModel } from './model/stage'; import { IUTaskflowstatusModel } from './model/taskflowstatus'; import { IUTaskflowModel } from './model/taskflow'; import { IUProjectModel } from './model/project'; import { IUMemberModel } from './model/member'; import { IUCustomfieldModel } from './model/customfield'; import { IUApplicationModel } from './model/application'; import { IUWorktimeModel } from './model/worktime'; import { IUObjectlinkModel } from './model/objectlink'; import { IUTagModel } from './model/tag'; import { IUApprelationModel } from './model/apprelation'; interface App extends Koa { db: { project: Model taskflow: Model taskflowstatus: Model scenariofieldconfig: Model stage: Model tasklist: Model smartgroup: Model member: Model user: Model task: Model customfield: Model application: Model apprelation: Model worktime: Model objectlink: Model tag: Model } token: string coreToken: string $emit: EventEmitter } interface Context extends Context { state: { lang: string selectBy: string user: DbCollection.User headers: any _scenariofieldconfigId: string downloadUrl: string fileType: string _testplanId: string _projectId: string isImport: string token _tasklistId: string importTask: string _organizationId: string _testhubId: string basic: boolean resource: string _projecttagId: string, customfieldIds: [string] } } interface Scenariofield { _id: string _roleIds: [string] _customfieldId: any required: boolean fieldType: string displayed: boolean } interface Task { content?: string note?: string startDate?: string dueDate?: string priority?: number _creatorId: string _organizationId: string _executorId?: string _projectId: string _tasklistId: string _stageId?: string tagIds?: string[] customfields?: Object[] ancestorIds?: string[] workTime?: { totalTime: number } storyPoint?: string progress?: number _scenariofieldconfigId: string _sprintId?: string _taskflowstatusId?: string parentTask?: string } interface ParsedData { content?: string note?: string startDate?: string dueDate?: string priority?: string _creatorId: string _organizationId: string _executorId?: string _projectId: string _tasklistId: string _stageId?: string tag?: string, customfields?: Object[], ancestorIds?: string[], workTime?: number, storyPoint?: string, taskProgress?: number, worktimes?: number, sprint?:string } interface ErrMsg { row: number, reason: string, celName: string, content: string } declare namespace ImportEmitterParams { interface ImportTasks { tasks: Object[] factory: TaskFactory } interface ImportTestcases { testcases: DbCollection.Testcase[] factory: TestcaseFactory } } declare namespace DbCollection { interface Sptrint { _id: string name: string status: string } interface Taskflowstatus { _id: string name: string kind: string } interface Project { _id: string name: string _organizationId?: string proTemplateType?: string normalType?: string } interface Commongroup { name: string _id: string } interface Testcase { _id?: string _projectId: string title: string _creatorId?: string accomplished?: string isDone?: boolean _testplanId: string _flowstatusId?: string _executorId?: string _scenariofieldconfigId: string steps: Array<{ desc: string expected: string }> caseType?: string priority: number involveMembers?: string[] precondition: string } interface BasicTestcase { _creatorId?: string _testhubId: string _id?: string priority?: number caseType?: string steps: Array<{ desc: string expected: string }> precondition?: string _executorId?: string title: string _commongroupId?: string } interface TestPlan { _id: string _projectId: string name: string } interface Testhub { _id: string isDeleted: boolean name: string isTemplate: boolean visibility: string _organizationId: string } interface TesthubGroup { ancestorIds: string[] isDeleted: boolean _id: string name: string } interface User { _id: string name: string } interface Member { _userId: { _id: string name: string } _id: string } } declare namespace OptionsCollection { namespace TestCase { interface TransformOtions { project?: DbCollection.Project _scenariofieldconfigId?: string _testplanId?: string _testhubId?: string _organizationId?: string } } }