Skip to content

Commit 7942a56

Browse files
Copilotsezanzeb
andauthored
Fix all TypeScript errors from yarn run frontend::typecheck
Agent-Logs-Url: https://github.com/hackaburg/tilt/sessions/9a61ab57-f8d4-45bc-83eb-de24dfea340c Co-authored-by: sezanzeb <28510156+sezanzeb@users.noreply.github.com>
1 parent 4bee27a commit 7942a56

28 files changed

Lines changed: 146 additions & 288 deletions

backend/src/controllers/rating-controller.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
import {
2-
Authorized,
3-
JsonController,
4-
CurrentUser,
5-
Get,
6-
Post,
7-
Body,
8-
Param,
9-
} from "routing-controllers";
1+
import { Authorized, JsonController, CurrentUser, Get, Post, Body, Param } from "routing-controllers";
102
import { Inject } from "typedi";
113
import { UserRole } from "../entities/user-role";
12-
import {
13-
SettingsServiceToken,
14-
ISettingsService,
15-
} from "../services/settings-service";
164
import { RatingServiceToken, IRatingService } from "../services/rating-service";
175
import {
186
RatingDTO,
@@ -25,7 +13,6 @@ import { Rating } from "../entities/rating";
2513
@JsonController("/ratings")
2614
export class RatingController {
2715
public constructor(
28-
@Inject(SettingsServiceToken) private readonly _settings: ISettingsService,
2916
@Inject(RatingServiceToken) private readonly _ratings: IRatingService,
3017
) {}
3118

backend/src/entities/criterion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Column, Entity, OneToOne, PrimaryGeneratedColumn } from "typeorm";
1+
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
22
import { Longtext } from "./longtext";
33

44
@Entity()

backend/src/services/project-service.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export const ProjectServiceToken = new Token<IProjectService>();
4747
export class ProjectService implements IProjectService {
4848
private _projects!: Repository<Project>;
4949
private _teams!: Repository<Team>;
50-
private _users!: Repository<User>;
5150
private _settings!: Repository<Settings>;
5251

5352
public constructor(
@@ -60,7 +59,6 @@ export class ProjectService implements IProjectService {
6059
public async bootstrap(): Promise<void> {
6160
this._projects = this._database.getRepository(Project);
6261
this._teams = this._database.getRepository(Team);
63-
this._users = this._database.getRepository(User);
6462
this._settings = this._database.getRepository(Settings);
6563
}
6664

backend/src/services/rating-service.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
BadRequestError,
32
ForbiddenError,
43
NotFoundError,
54
} from "routing-controllers";
@@ -60,7 +59,6 @@ export class RatingService implements IRatingService {
6059
private _ratings!: Repository<Rating>;
6160
private _projects!: Repository<Project>;
6261
private _teams!: Repository<Team>;
63-
private _users!: Repository<User>;
6462

6563
public constructor(
6664
@Inject(DatabaseServiceToken) private readonly _database: IDatabaseService,
@@ -74,7 +72,6 @@ export class RatingService implements IRatingService {
7472
this._ratings = this._database.getRepository(Rating);
7573
this._projects = this._database.getRepository(Project);
7674
this._teams = this._database.getRepository(Team);
77-
this._users = this._database.getRepository(User);
7875
}
7976

8077
/**
@@ -206,7 +203,6 @@ export class RatingService implements IRatingService {
206203
}
207204

208205
// Calculate average
209-
const criterionIdToAvg: Record<number, number> = {};
210206
for (const criterionId in criterionIdToSum) {
211207
const average =
212208
criterionIdToSum[criterionId] / criterionIdToCount[criterionId];

frontend/src/api/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,8 @@ export class ApiClient {
592592
* Get Project by Id
593593
* @return project by id
594594
*/
595-
public async getProjectByID(id: number): Promise<TeamResponseDTO> {
596-
return await this.get<ApplicationControllerMethods["getTeamByID"]>(
595+
public async getProjectByID(id: number): Promise<ProjectDTO> {
596+
return await this.get<ProjectsControllerMethods["getProjectByID"]>(
597597
`/projects/${id}`,
598598
);
599599
}
@@ -630,7 +630,7 @@ export class ApiClient {
630630
* Gets all ratings.
631631
*/
632632
public async getUsersRatingsForProject(
633-
project,
633+
project: ProjectDTO,
634634
): Promise<readonly RatingDTO[]> {
635635
return await this.get<RatingControllerMethods["getUsersRatingsForProject"]>(
636636
`/ratings/by-project/${project.id}`,
@@ -651,7 +651,7 @@ export class ApiClient {
651651
* @param rating The rating to submit
652652
*/
653653
public async createRating(rating: RatingDTO): Promise<RatingDTO> {
654-
return await this.post<RatingControllerMethods["createRating"]>(
654+
return await this.post<RatingControllerMethods["rate"]>(
655655
"/ratings/rate",
656656
rating,
657657
);

frontend/src/api/types/controllers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ export * from "../../../../backend/src/controllers/settings-controller";
33
export * from "../../../../backend/src/controllers/users-controller";
44
export * from "../../../../backend/src/controllers/application-controller";
55
export * from "../../../../backend/src/controllers/system-controller";
6-
export * from "../../../../backend/src/controllers/criterioncontroller";
6+
export * from "../../../../backend/src/controllers/criterion-controller";
77
export * from "../../../../backend/src/controllers/projects-controller";
88
export * from "../../../../backend/src/controllers/rating-controller";

frontend/src/components/base/button.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ export const Button = ({
7676
disable = false,
7777
primary = false,
7878
loading = false,
79-
wide = false,
8079
color,
81-
href = null,
8280
}: IButtonProps) => {
8381
const handleClick = useCallback(
8482
(event: React.MouseEvent) => {

frontend/src/components/base/chevron.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface IChevronProps {
1111
color?: string;
1212
size?: number;
1313
rotation?: number;
14+
style?: React.CSSProperties;
1415
}
1516

1617
/**

frontend/src/components/base/collapsible.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ import { useToggle } from "../../hooks/use-toggle";
55
import { Chevron } from "./chevron";
66
import {
77
FlexColumnContainer,
8-
NonGrowingFlexContainer,
98
Spacer,
109
VerticallyCenteredContainer,
1110
} from "./flex";
12-
import { Subsubheading } from "./headings";
1311

1412
const ExpandButton = styled.button`
1513
cursor: pointer;
@@ -39,18 +37,18 @@ export const Collapsible = ({
3937
<FlexColumnContainer>
4038
<VerticallyCenteredContainer>
4139
<ExpandButton onClick={handleOpen}>
42-
<span style={{ "font-size": "1.25rem", "margin-right": "10px" }}>
40+
<span style={{ fontSize: "1.25rem", marginRight: "10px" }}>
4341
{title}
4442
</span>
4543
<Chevron
4644
rotation={isOpen ? 0 : -90}
47-
style={{ "vertical-align": "center" }}
45+
style={{ verticalAlign: "center" }}
4846
/>
4947
</ExpandButton>
5048
</VerticallyCenteredContainer>
5149

5250
{isOpen && (
53-
<FlexColumnContainer style={{ "padding-top": "5px" }}>
51+
<FlexColumnContainer style={{ paddingTop: "5px" }}>
5452
{children}
5553
<Spacer />
5654
</FlexColumnContainer>

frontend/src/components/base/dialog.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { FaLinkedin } from "react-icons/fa";
1818
export interface SimpleDialogProps {
1919
open: boolean;
2020
onClose: (value: true) => void;
21-
Button;
2221
}
2322

2423
/**

0 commit comments

Comments
 (0)