Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lib proto imports #36

Merged
merged 2 commits into from
Nov 27, 2024
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
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
2 changes: 2 additions & 0 deletions proto/shares.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
syntax = "proto3";

import "lib.proto";

package shares;

service SharesService {
Expand Down