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, subscriptionId: userContext.subscriptionId,
resourceGroup: userContext.resourceGroup, resourceGroup: userContext.resourceGroup,
accountName: userContext.databaseAccount.name, accountName: userContext.databaseAccount.name,
resource: `dbs/${database.id}/colls/${collection.id}`, resource: `dbs/${database.id()}/colls/${collection.id}`,
status: "new", status: "new",
}); });
expect(checkForSchema).not.toBeNull(); expect(checkForSchema).not.toBeNull();
expect(database.junoClient.getSchema).toBeCalledWith( expect(database.junoClient.getSchema).toBeCalledWith(
userContext.subscriptionId,
userContext.resourceGroup,
userContext.databaseAccount.name, userContext.databaseAccount.name,
database.id(), database.id(),
collection.id collection.id

View File

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

View File

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