After inheriting an app from a previous developer, I find myself at a loss when debugging the code. This is my first encounter with Typescript, adding to the challenge. Despite searching on StackOverflow, I couldn't find a solution to my issue. Here's where I'm stuck:
The C# definition of an entity named "Task" is as follows:
public class Task : ModelBase
{
public Task()
{
FiscalYears = new List<TaskFy>(28);
Flags = new List<TaskFlags>();
}
[Required, AuditField("Project", typeof(Project))]
public Guid Project_Id { get; set; }
public virtual Project Project { get; set; }
//<snip, other properties here>
public virtual List<TaskFy> FiscalYears { get; set; }
public virtual List<Workpackage> Workpackages { get; set; }
public virtual List<TaskFlags> Flags { get; set; }
}
In the Typescript definition:
export interface ITask extends ng.resource.IResource<ITask> {
id: string;
projectId: string;
isActive: boolean;
taskName: string;
title: string;
description: string;
ato: IDropdown;
atoId: string;
dto: IDropdown;
dtoId: string;
performerId: string;
performer: IPerformer;
//<snip, same properties here>
fiscalYears?: ITaskFy[];
}
The code in taskCtrl.ts is causing some trouble:
export default class TasksCtrl {
static $controllerAs = 'p';
private isEditing: boolean;
//<snip, other private properties here>
constructor(private $stateParams: ITaskParams, private $state: ng.ui.IStateService,
private $modal: ng.ui.bootstrap.IModalService, private task: ITaskResource) {
//<snip, constructor logic here>
}
//<snip, other methods here>
When using the new repo version of the project, I encountered this error:
Error in resource configuration for action `get`. Expected response to contain an object but got an array.
Running both old and new repos simultaneously seemed to resolve one issue but caused another related to null references.
If you can provide any insights or need more details, please let me know. Thank you!