Skip to content

Commit

Permalink
Refactor code and fix formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed Feb 27, 2024
1 parent abd3385 commit eaf93f4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 20 deletions.
8 changes: 6 additions & 2 deletions Common/Types/Database/UniqueColumnBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ type GetUniqueColumnByFunction = <T extends BaseModel>(
propertyKey: string
) => string;

export const getUniqueColumnBy: GetUniqueColumnByFunction = <T extends BaseModel>(
export const getUniqueColumnBy: GetUniqueColumnByFunction = <
T extends BaseModel
>(
target: T,
propertyKey: string
): string => {
Expand All @@ -25,7 +27,9 @@ type GetUniqueColumnsByFunction = <T extends BaseModel>(
target: T
) => Dictionary<string>;

export const getUniqueColumnsBy: GetUniqueColumnsByFunction = <T extends BaseModel>(
export const getUniqueColumnsBy: GetUniqueColumnsByFunction = <
T extends BaseModel
>(
target: T
): Dictionary<string> => {
const dictonary: Dictionary<string> = {};
Expand Down
15 changes: 5 additions & 10 deletions CommonServer/Utils/BasicCron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@ type BasicCronProps = {
options: {
schedule: string;
runOnStartup: boolean;
},
runFunction: PromiseVoidFunction
}

type BasicCronFunction = (
props: BasicCronProps
) => void;
};
runFunction: PromiseVoidFunction;
};

const BasicCron: BasicCronFunction = (
props: BasicCronProps
): void => {
type BasicCronFunction = (props: BasicCronProps) => void;

const BasicCron: BasicCronFunction = (props: BasicCronProps): void => {
const { jobName, options, runFunction } = props;

cron.schedule(options.schedule, async () => {
Expand Down
2 changes: 1 addition & 1 deletion CommonServer/Utils/Express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Express {

type ResolveFunction = (app: express.Application) => void;

return new Promise<express.Application>((resolve:ResolveFunction) => {
return new Promise<express.Application>((resolve: ResolveFunction) => {
this.httpServer.listen(
port?.toNumber() || this.app.get('port'),
() => {
Expand Down
6 changes: 3 additions & 3 deletions CommonServer/Utils/LocalFile.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import fs from 'fs';
import {PromiseRejectErrorFunction} from 'Common/Types/FunctionTypes';
import { PromiseRejectErrorFunction } from 'Common/Types/FunctionTypes';

export default class LocalFile {
public static async makeDirectory(path: string): Promise<void> {
return new Promise(
(resolve: Function, reject: PromiseRejectErrorFunction) => {
fs.mkdir(path, { recursive: true }, (err: Error | null) => {
fs.mkdir(path, { recursive: true }, (err: Error | null) => {
if (err) {
return reject(err);
}
Expand All @@ -18,7 +18,7 @@ export default class LocalFile {
public static async write(path: string, data: string): Promise<void> {
return new Promise(
(resolve: Function, reject: PromiseRejectErrorFunction) => {
fs.writeFile(path, data, (err: Error | null) => {
fs.writeFile(path, data, (err: Error | null) => {
if (err) {
return reject(err);
}
Expand Down
1 change: 0 additions & 1 deletion CommonUI/src/Components/HeaderAlert/HeaderModelAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const HeaderModelAlert: <TBaseModel extends BaseModel>(
}, [props.refreshToggle]);

const fetchCount: PromiseVoidFunction = async (): Promise<void> => {

setError('');
setIsLoading(true);

Expand Down
2 changes: 0 additions & 2 deletions CommonUI/src/Components/ModelProgress/ModelProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ const ModelProgress: <TBaseModel extends BaseModel>(
};

useEffect(() => {

fetchCount().catch((err: Error) => {
setError(API.getFriendlyMessage(err));
});

}, []);

return (
Expand Down
4 changes: 3 additions & 1 deletion CommonUI/src/Tests/Components/Card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ describe('Card', () => {

type RenderComponentFunction = (props: ComponentProps) => void;

const renderComponent: RenderComponentFunction = (props: ComponentProps): void => {
const renderComponent: RenderComponentFunction = (
props: ComponentProps
): void => {
render(<Card {...props} />);
};

Expand Down

0 comments on commit eaf93f4

Please sign in to comment.