Skip to content

Commit

Permalink
Format the codebase with Prettier 3.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
wcalderipe committed Feb 19, 2024
1 parent 18184d9 commit e483080
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 37 deletions.
5 changes: 4 additions & 1 deletion apps/authz/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export const finalizeDecision = (response: OpaResult[]) => {

@Injectable()
export class AppService {
constructor(private opaService: OpaService, private entityRepository: EntityRepository) {}
constructor(
private opaService: OpaService,
private entityRepository: EntityRepository
) {}

async #verifySignature(requestSignature: Signature, verificationMessage: string): Promise<CredentialEntity> {
const { pubKey, alg, sig } = requestSignature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import { DataFeed } from '../type/data-feed.type'
export class PriceFeedService implements DataFeed<Prices> {
static SOURCE_ID = 'armory/price-feed'

constructor(private priceService: PriceService, private configService: ConfigService<Config, true>) {}
constructor(
private priceService: PriceService,
private configService: ConfigService<Config, true>
) {}

getId(): string {
return PriceFeedService.SOURCE_ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,16 @@ export class ClusterService {
nodes: Node[],
responses: EvaluationResponse[]
): { node: Node; response: EvaluationResponse }[] {
return zip(nodes, responses).reduce((acc, [node, response]) => {
if (node && response) {
return [...acc, { node, response }]
}
return zip(nodes, responses).reduce(
(acc, [node, response]) => {
if (node && response) {
return [...acc, { node, response }]
}

return acc
}, [] as { node: Node; response: EvaluationResponse }[])
return acc
},
[] as { node: Node; response: EvaluationResponse }[]
)
}

private async recoverPubKey(response: EvaluationResponse) {
Expand Down
38 changes: 22 additions & 16 deletions apps/orchestration/src/price/core/service/price.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ type GetPricesOption = {
export class PriceService {
private logger = new Logger(PriceService.name)

constructor(private coinGeckoClient: CoinGeckoClient, private coinGeckoAssetRepository: CoinGeckoAssetRepository) {}
constructor(
private coinGeckoClient: CoinGeckoClient,
private coinGeckoAssetRepository: CoinGeckoAssetRepository
) {}

async getPrices(options: GetPricesOption): Promise<Prices> {
this.logger.log('Get prices', options)
Expand Down Expand Up @@ -68,22 +71,25 @@ export class PriceService {
}

private getAssetsPriceInformation(simplePrice: SimplePrice) {
return Object.keys(simplePrice).reduce((acc, coinId) => {
const sourceAssetIds = this.coinGeckoAssetRepository.getAssetIds(coinId)

if (sourceAssetIds) {
return [
...acc,
...sourceAssetIds.map((sourceAssetId) => ({
sourceAssetId,
coinId,
values: this.getValues(simplePrice, coinId)
}))
]
}
return Object.keys(simplePrice).reduce(
(acc, coinId) => {
const sourceAssetIds = this.coinGeckoAssetRepository.getAssetIds(coinId)

return acc
}, [] as { sourceAssetId: AssetId; coinId: string; values: unknown }[])
if (sourceAssetIds) {
return [
...acc,
...sourceAssetIds.map((sourceAssetId) => ({
sourceAssetId,
coinId,
values: this.getValues(simplePrice, coinId)
}))
]
}

return acc
},
[] as { sourceAssetId: AssetId; coinId: string; values: unknown }[]
)
}

private getValues(simplePrice: SimplePrice, coinId: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { UserService } from './user.service'

@Injectable()
export class OrganizationService {
constructor(private orgRepository: OrganizationRepository, private userService: UserService) {}
constructor(
private orgRepository: OrganizationRepository,
private userService: UserService
) {}

async create(input: { uid: string; rootCredential: CredentialEntity }): Promise<{
organization: OrganizationEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { UserRepository } from '../../persistence/repository/user.repository'

@Injectable()
export class UserService {
constructor(private userRepository: UserRepository, private userWalletRepository: UserWalletRepository) {}
constructor(
private userRepository: UserRepository,
private userWalletRepository: UserWalletRepository
) {}

create(orgId: string, user: UserEntity, credential?: CredentialEntity): Promise<UserEntity> {
return this.userRepository.create(orgId, user, credential)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { WalletRepository } from '../../persistence/repository/wallet.repository

@Injectable()
export class WalletService {
constructor(private walletRepository: WalletRepository, private walletGroupRepository: WalletGroupRepository) {}
constructor(
private walletRepository: WalletRepository,
private walletGroupRepository: WalletGroupRepository
) {}

async create(orgId: string, wallet: WalletEntity): Promise<WalletEntity> {
return this.walletRepository.create(orgId, wallet)
Expand Down
23 changes: 13 additions & 10 deletions packages/authz-shared/src/lib/util/enum.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ export const convertEnums = <T extends Record<string, string>>(
enumMap: EnumMap<T>,
data: T
): EnumConverted<T, EnumMap<T>> => {
return Object.entries(data).reduce((acc, [key, value]) => {
if (key in enumMap) {
acc[key as keyof T] = toEnum(enumMap[key as keyof EnumMap<T>], value) as EnumConverted<T, EnumMap<T>>[keyof T]
if (acc[key] === undefined || acc[key] === null) {
throw new Error(`Invalid enum value for key ${key}: ${value}`)
return Object.entries(data).reduce(
(acc, [key, value]) => {
if (key in enumMap) {
acc[key as keyof T] = toEnum(enumMap[key as keyof EnumMap<T>], value) as EnumConverted<T, EnumMap<T>>[keyof T]
if (acc[key] === undefined || acc[key] === null) {
throw new Error(`Invalid enum value for key ${key}: ${value}`)
}
} else {
acc[key as keyof T] = value as EnumConverted<T, EnumMap<T>>[keyof T]
}
} else {
acc[key as keyof T] = value as EnumConverted<T, EnumMap<T>>[keyof T]
}
return acc
}, {} as EnumConverted<T, EnumMap<T>>)
return acc
},
{} as EnumConverted<T, EnumMap<T>>
)
}

export const convertEnumsArray = <T extends Record<string, string>>(
Expand Down

0 comments on commit e483080

Please sign in to comment.