Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ export class DatabaseConfigService {
* Default: 'log,info,warn,error'
*/
get logging(): string {
return this.configService.get<string>('POSTGRES_LOGGING', 'log,info,warn,error');
return this.configService.get<string>(
'POSTGRES_LOGGING',
'log,info,warn,error',
);
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddManifestUrl1728552691568 implements MigrationInterface {
name = 'AddManifestUrl1728552691568'
name = 'AddManifestUrl1728552691568';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE "hmt"."jobs"
ADD "manifest_url" character varying
`);
}
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE "hmt"."jobs" DROP COLUMN "manifest_url"
`);
}

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { createMock } from '@golevelup/ts-jest';
import { ConfigService } from '@nestjs/config';
import { Test } from '@nestjs/testing';
import { MOCK_ADDRESS, MOCK_MANIFEST_URL, MOCK_PRIVATE_KEY } from '../../../test/constants';
import {
MOCK_ADDRESS,
MOCK_MANIFEST_URL,
MOCK_PRIVATE_KEY,
} from '../../../test/constants';
import { TOKEN } from '../../common/constant';
import { AssignmentStatus, JobType } from '../../common/enums/job';
import { AssignmentRepository } from '../assignment/assignment.repository';
Expand Down Expand Up @@ -133,7 +137,11 @@ describe('AssignmentService', () => {

expect(result).toEqual(undefined);
expect(assignmentRepository.createUnique).toHaveBeenCalledWith({
job: { id: 1, manifestUrl: MOCK_MANIFEST_URL, reputationNetwork: reputationNetwork },
job: {
id: 1,
manifestUrl: MOCK_MANIFEST_URL,
reputationNetwork: reputationNetwork,
},
workerAddress: workerAddress,
status: AssignmentStatus.ACTIVE,
expiresAt: expect.any(Date),
Expand All @@ -142,7 +150,7 @@ describe('AssignmentService', () => {
expect(jobService.getManifest).toHaveBeenCalledWith(
chainId,
escrowAddress,
MOCK_MANIFEST_URL
MOCK_MANIFEST_URL,
);
});

Expand Down Expand Up @@ -174,7 +182,7 @@ describe('AssignmentService', () => {
expect(jobService.getManifest).toHaveBeenCalledWith(
chainId,
escrowAddress,
MOCK_MANIFEST_URL
MOCK_MANIFEST_URL,
);
});

Expand Down Expand Up @@ -312,7 +320,7 @@ describe('AssignmentService', () => {
job: {
chainId: 1,
escrowAddress,
manifestUrl: MOCK_MANIFEST_URL
manifestUrl: MOCK_MANIFEST_URL,
},
status: AssignmentStatus.ACTIVE,
createdAt: new Date(),
Expand Down Expand Up @@ -372,7 +380,7 @@ describe('AssignmentService', () => {
expect(jobService.getManifest).toHaveBeenCalledWith(
chainId,
escrowAddress,
MOCK_MANIFEST_URL
MOCK_MANIFEST_URL,
);
expect(assignmentRepository.fetchFiltered).toHaveBeenCalledWith({
page: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class AssignmentService {
const manifest = await this.jobService.getManifest(
data.chainId,
data.escrowAddress,
jobEntity.manifestUrl
jobEntity.manifestUrl,
);

// Check if all required qualifications are present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ describe('JobService', () => {
expect(jobService.getManifest).toHaveBeenCalledWith(
chainId,
escrowAddress,
MOCK_MANIFEST_URL
MOCK_MANIFEST_URL,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class JobService {
const manifest = await this.getManifest(
entity.chainId,
entity.escrowAddress,
entity.manifestUrl
entity.manifestUrl,
);
if (data.fields?.includes(JobFieldName.JobDescription)) {
job.jobDescription = manifest.requesterDescription;
Expand Down Expand Up @@ -299,7 +299,11 @@ export class JobService {
throw new BadRequestException(ErrorJob.SolutionAlreadySubmitted);
}

const manifest = await this.getManifest(chainId, escrowAddress, manifestUrl);
const manifest = await this.getManifest(
chainId,
escrowAddress,
manifestUrl,
);
if (
existingJobSolutions.filter((solution) => !solution.error).length >=
manifest.submissionsRequired
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/human-app/frontend/src/api/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function createFetcher(defaultFetcherConfig?: {
: fetcherOptions.options;
if (fetcherOptions.authenticated) {
fetcherOptionsWithDefaults = appendHeader(fetcherOptionsWithDefaults, {
Authorization: `Bearer ${browserAuthProvider.getAccessToken()}`,
Authorization: `Bearer ${browserAuthProvider.getAccessToken() ?? ''}`,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export function useHMTokenDecimals() {
signer: data?.signer,
});
},
queryKey: ['decimals', chainId, data?.signer || 'signer'],
queryKey: ['decimals', chainId, data?.signer ?? 'signer'],
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const getAvailableJobsTableData = async (dto: GetJobTableDataDto) => {
export function useGetAvailableJobsData() {
const { filterParams } = useJobsFilterStore();
const { address: oracle_address } = useParams<{ address: string }>();
const dto = { ...filterParams, oracle_address: oracle_address || '' };
const dto = { ...filterParams, oracle_address: oracle_address ?? '' };

return useQuery({
queryKey: ['availableJobs', dto],
Expand All @@ -58,7 +58,7 @@ export function useGetAvailableJobsData() {
export function useInfiniteGetAvailableJobsData() {
const { filterParams } = useJobsFilterStore();
const { address: oracle_address } = useParams<{ address: string }>();
const dto = { ...filterParams, oracle_address: oracle_address || '' };
const dto = { ...filterParams, oracle_address: oracle_address ?? '' };

return useInfiniteQuery({
initialPageParam: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function useGetOnChainRegisteredAddress() {

const registeredAddressOnChain = await ethKVStoreGetKycData({
contractAddress,
accountAddress: user.wallet_address || address || '',
accountAddress: user.wallet_address ?? address ?? '',
kycKey: `KYC-${user.reputation_network}`,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const getMyJobsTableData = async (dto: GetMyJobTableDataDto) => {
export function useGetMyJobsData() {
const { filterParams } = useMyJobsFilterStore();
const { address } = useParams<{ address: string }>();
const dto = { ...filterParams, oracle_address: address || '' };
const dto = { ...filterParams, oracle_address: address ?? '' };
return useQuery({
queryKey: ['myJobs', dto],
queryFn: () => getMyJobsTableData(dto),
Expand All @@ -61,7 +61,7 @@ export function useGetMyJobsData() {
export function useInfiniteGetMyJobsData() {
const { filterParams } = useMyJobsFilterStore();
const { address } = useParams<{ address: string }>();
const dto = { ...filterParams, oracle_address: address || '' };
const dto = { ...filterParams, oracle_address: address ?? '' };

return useInfiniteQuery({
initialPageParam: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function useRegisterAddressOnChainMutation() {
await registerAddressInKVStore({
...data,
signer: web3ProviderMutation.data?.signer,
chainId: chainId || -1,
chainId: chainId ?? -1,
});
},
onSuccess: async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function Input({
}
: undefined
}
autoComplete={autoComplete || name}
autoComplete={autoComplete ?? name}
error={Boolean(fieldState.error)}
fullWidth
helperText={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,15 @@ export function MultiSelect({
<Select
input={<OutlinedInput id={name} label={label} />}
{...field}
defaultValue={[]}
defaultValue={[] as string[]}
error={Boolean(fieldState.error)}
id={name}
labelId={`${name}-${label}`}
multiple
renderValue={renderValue}
sx={{
'& .MuiSvgIcon-root': { color: colorPalette.primary.main },
}}
renderValue={(selected) => renderValue(selected as string[])}
{...props}
onChange={(event) => {
handleChange(event, field);
handleChange(event as SelectChangeEvent<string[]>, field);
}}
>
{options.map((option) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export function RadioButton({
render={({ field, fieldState }) => (
<FormControl error={Boolean(fieldState.error)}>
{groupLabel ? (
<FormLabel id={ariaLabelledby || name}>{groupLabel}</FormLabel>
<FormLabel id={ariaLabelledby ?? name}>{groupLabel}</FormLabel>
) : null}
<RadioGroup
{...field}
aria-labelledby={ariaLabelledby || name}
aria-labelledby={ariaLabelledby ?? name}
name={name}
{...rest}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function Slider({
{...field}
max={max}
min={min}
step={step || 10}
step={step ?? 10}
valueLabelDisplay="auto"
{...rest}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { t } from 'i18next';
import type { BottomMenuItem } from '@/components/layout/protected/drawer-navigation';
import { HelpIcon, UserOutlinedIcon } from '@/components/ui/icons';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { t } from 'i18next';
import type {
BottomMenuItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ export function Layout({
zIndex: 200,
top: '0',
left: '0',
width: notificationWith ? `${notificationWith}px` : 'unset',
width: notificationWith
? `${notificationWith.toString()}px`
: 'unset',
},
}}
>
Expand All @@ -168,7 +170,9 @@ export function Layout({
sx={{
minHeight: '3.2rem',
position: 'fixed',
width: notificationWith ? `${notificationWith}px` : 'unset',
width: notificationWith
? `${notificationWith.toString()}px`
: 'unset',
zIndex: '10',
[breakpoints.mobile]: {
minHeight: 'unset',
Expand Down Expand Up @@ -201,6 +205,7 @@ export function Layout({
</Grid>
<Grid
component="div"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error -- ...
ref={layoutElementRef}
sx={{ height: '100%' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type CustomButtonProps = ButtonProps &
export const Button = forwardRef<HTMLButtonElement, CustomButtonProps>(
({ children, loading, disabled, ...props }, ref) => {
return (
<MuiButton ref={ref} {...props} disabled={disabled || loading}>
<MuiButton ref={ref} {...props} disabled={disabled ?? loading}>
<>{loading ? <CircularProgress size={24} /> : children}</>
</MuiButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export function Counter({
return `${padZero(time.hours)}:${padZero(time.minutes)}:${padZero(time.seconds)}`;
}

return `${time.days}:${padZero(time.hours)}:${padZero(time.minutes)}:${padZero(time.seconds)}`;
return `${time.days.toString()}:${padZero(time.hours)}:${padZero(time.minutes)}:${padZero(time.seconds)}`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function JWTExpirationCheck({
useEffect(() => {
if (
location.pathname.includes('profile') &&
(web2Auth.user || web3Auth.user)
(web2Auth.user ?? web3Auth.user)
) {
checksOnProfile.current = checksOnProfile.current + 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export function Chat({
chatElement.style.position = 'absolute';
if (displayChatIcon) {
chatElement.style.opacity = '1';
chatElement.style.top = `${refRect.top - rootRect.top}px`;
chatElement.style.left = `${refRect.left - rootRect.left}px`;
chatElement.style.width = `${refRect.width}px`;
chatElement.style.height = `${refRect.height}px`;
chatElement.style.top = `${(refRect.top - rootRect.top).toString()}px`;
chatElement.style.left = `${(refRect.left - rootRect.left).toString()}px`;
chatElement.style.width = `${refRect.width.toString()}px`;
chatElement.style.height = `${refRect.height.toString()}px`;
} else {
chatElement.style.opacity = '0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function ProfileDisableButton() {

const disableOperator = async (signaturePayload: SignatureData) => {
const signature = await signMessage(JSON.stringify(signaturePayload));
disableOperatorMutation({ signature: signature || '' });
disableOperatorMutation({ signature: signature ?? '' });
};

if (isSignatureDataError || isDisableOperatorError) {
Expand Down
Loading
Loading