Change schema endpoints (#447)

* fix resource bug (id is a method)

* change schema endpoints

* fix test

Co-authored-by: REDMOND\gaausfel <gaausfel@microsoft.com>
This commit is contained in:
Garrett Ausfeldt 2021-02-25 11:36:01 -08:00 committed by GitHub
parent 8629bcbe2d
commit 864d9393f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -69,11 +69,13 @@ describe("Add Schema", () => {
subscriptionId: userContext.subscriptionId,
resourceGroup: userContext.resourceGroup,
accountName: userContext.databaseAccount.name,
resource: `dbs/${database.id}/colls/${collection.id}`,
resource: `dbs/${database.id()}/colls/${collection.id}`,
status: "new",
});
expect(checkForSchema).not.toBeNull();
expect(database.junoClient.getSchema).toBeCalledWith(
userContext.subscriptionId,
userContext.resourceGroup,
userContext.databaseAccount.name,
database.id(),
collection.id

View File

@ -329,11 +329,13 @@ export default class Database implements ViewModels.Database {
subscriptionId: userContext.subscriptionId,
resourceGroup: userContext.resourceGroup,
accountName: userContext.databaseAccount.name,
resource: `dbs/${this.id}/colls/${collection.id}`,
resource: `dbs/${this.id()}/colls/${collection.id}`,
status: "new",
});
checkForSchema = setInterval(async () => {
const response: IJunoResponse<DataModels.ISchema> = await this.junoClient.getSchema(
userContext.subscriptionId,
userContext.resourceGroup,
userContext.databaseAccount.name,
this.id(),
collection.id

View File

@ -427,7 +427,7 @@ export class JunoClient {
public async requestSchema(
schemaRequest: DataModels.ISchemaRequest
): Promise<IJunoResponse<DataModels.ISchemaRequest>> {
const response = await window.fetch(`${this.getAnalyticsUrl()}/${schemaRequest.accountName}/schema/request`, {
const response = await window.fetch(`${this.getAnalyticsUrl()}/schema/request`, {
method: "POST",
body: JSON.stringify(schemaRequest),
headers: JunoClient.getHeaders(),
@ -445,12 +445,14 @@ export class JunoClient {
}
public async getSchema(
subscriptionId: string,
resourceGroup: string,
accountName: string,
databaseName: string,
containerName: string
): Promise<IJunoResponse<DataModels.ISchema>> {
const response = await window.fetch(
`${this.getAnalyticsUrl()}/${accountName}/schema/${databaseName}/${containerName}`,
`${this.getAnalyticsUrl()}/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/databaseAccounts/${accountName}/schema/${databaseName}/${containerName}`,
{
method: "GET",
headers: JunoClient.getHeaders(),