Skip to content

Commit

Permalink
chore: simplify dto
Browse files Browse the repository at this point in the history
  • Loading branch information
okjodom committed Nov 27, 2024
1 parent 8c926ec commit 54ad6a4
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 53 deletions.
12 changes: 6 additions & 6 deletions apps/api/src/admin/admin.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ describe('AdminController', () => {
hasShares: false,
},
swapStatus: {
isRunning: true
}
})
}
}
]
isRunning: true,
},
}),
},
},
],
});

controller = module.get<AdminController>(AdminController);
Expand Down
4 changes: 1 addition & 3 deletions apps/api/src/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { AdminService } from './admin.service';
export class AdminController {
private readonly logger = new Logger(AdminController.name);

constructor(
private readonly adminService: AdminService,
) {
constructor(private readonly adminService: AdminService) {
this.logger.log('AdminController initialized');
}

Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export class AdminService {
async getStatus(): Promise<BitsaccoStatus> {
return {
memberStatus: {
hasShares: false
hasShares: false,
},
swapStatus: {
isRunning: true
isRunning: true,
},
}
};
}
}
8 changes: 7 additions & 1 deletion apps/api/src/api.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ import { AdminService } from './admin/admin.service';
SmsController,
SharesController,
],
providers: [SwapService, NostrService, SmsService, SharesService, AdminService],
providers: [
SwapService,
NostrService,
SmsService,
SharesService,
AdminService,
],
})
export class ApiModule {}
2 changes: 0 additions & 2 deletions libs/common/src/dto/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

export * from './swap.dto';
export * from './quote.dto';
export * from './nostr.dto';
export * from './sms.dto';
export * from './shares.dto';
Expand Down
7 changes: 6 additions & 1 deletion libs/common/src/dto/nostr.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import {
} from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty } from '@nestjs/swagger';
import { ConfigureNostrRelaysRequest, NostrDirectMessageRequest, NostrRecipient, NostrRelay } from '../types';
import {
ConfigureNostrRelaysRequest,
NostrDirectMessageRequest,
NostrRecipient,
NostrRelay,
} from '../types';

class NostrRecipientDto implements NostrRecipient {
@IsOptional()
Expand Down
18 changes: 0 additions & 18 deletions libs/common/src/dto/payments.dto.ts

This file was deleted.

15 changes: 0 additions & 15 deletions libs/common/src/dto/quote.dto.ts

This file was deleted.

32 changes: 29 additions & 3 deletions libs/common/src/dto/swap.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ValidateNested,
IsNumber,
Min,
IsBoolean,
} from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty } from '@nestjs/swagger';
Expand All @@ -22,10 +23,36 @@ import {
OfframpSwapRequest,
OfframpSwapTarget,
PaginatedRequest,
MobileMoney,
Bolt11,
} from '../types';
import { Bolt11InvoiceDto, MobileMoneyDto } from './payments.dto';
import { TransformToCurrency } from './transforms';
import { QuoteDto } from './quote.dto';

export class QuoteDto {
@IsString()
@Type(() => String)
@ApiProperty()
id: string;

@IsBoolean()
@Type(() => Boolean)
@ApiProperty()
refreshIfExpired: boolean;
}

export class MobileMoneyDto implements MobileMoney {
@IsString()
@Type(() => String)
@ApiProperty()
phone: string;
}

export class Bolt11InvoiceDto implements Bolt11 {
@IsString()
@Type(() => String)
@ApiProperty()
invoice: string;
}

class OnrampSwapSourceDto implements OnrampSwapSource {
@IsEnum(Currency)
Expand Down Expand Up @@ -81,7 +108,6 @@ export class CreateOnrampSwapDto implements OnrampSwapRequest {
target: OnrampSwapTargetDto;
}


class OfframpSwapTargetDto implements OfframpSwapTarget {
@IsEnum(Currency)
@TransformToCurrency()
Expand Down
2 changes: 1 addition & 1 deletion libs/common/src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface MemberStatus {
}

interface ServiceStatus {
isRunning: boolean
isRunning: boolean;
}

export interface BitsaccoStatus {
Expand Down

0 comments on commit 54ad6a4

Please sign in to comment.