-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider): new provider trial endpoint
(#488)
- Loading branch information
Showing
17 changed files
with
70 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const TRIAL_ATTRIBUTE = "console/trials"; | ||
export const AUDITOR = "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"; |
12 changes: 12 additions & 0 deletions
12
apps/api/src/deployment/controllers/provider/provider.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { singleton } from "tsyringe"; | ||
|
||
import { TrialProvidersService } from "@src/deployment/services/trial-providers/trial-providers.service"; | ||
|
||
@singleton() | ||
export class ProviderController { | ||
constructor(private readonly trialProvidersService: TrialProvidersService) {} | ||
|
||
async getTrialProviders(): Promise<string[]> { | ||
return await this.trialProvidersService.getTrialProviders(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/api/src/deployment/repositories/provider/provider.repository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ProviderAttributeSignature } from "@akashnetwork/database/dbSchemas/akash"; | ||
import { singleton } from "tsyringe"; | ||
|
||
import { AUDITOR, TRIAL_ATTRIBUTE } from "@src/deployment/config/provider.config"; | ||
|
||
@singleton() | ||
export class ProviderRepository { | ||
async getTrialProviders(): Promise<string[]> { | ||
const trialProviders = await ProviderAttributeSignature.findAll({ | ||
attributes: ["provider"], | ||
where: { | ||
auditor: AUDITOR, | ||
key: TRIAL_ATTRIBUTE, | ||
value: "true" | ||
}, | ||
raw: true | ||
}); | ||
|
||
return trialProviders.map(provider => provider.provider); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/api/src/deployment/services/trial-providers/trial-providers.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { singleton } from "tsyringe"; | ||
|
||
import { ProviderRepository } from "@src/deployment/repositories/provider/provider.repository"; | ||
|
||
@singleton() | ||
export class TrialProvidersService { | ||
constructor(private readonly providerRepository: ProviderRepository) {} | ||
|
||
async getTrialProviders(): Promise<string[]> { | ||
return await this.providerRepository.getTrialProviders(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters