Skip to content

Commit aeb6a5a

Browse files
Support new technology/plan params for database (#490)
* feat(databases) : support new params * lint * extend DatabaseAppDashboard with new database object * DatabaseAppDashboard support database * lint * add database to Database * update * CR suggestions * fix test * Update src/Databases/index.ts Co-authored-by: Aurélien Reeves <[email protected]> * Update src/models/regional/databases.ts Co-authored-by: Aurélien Reeves <[email protected]> * Update test/Databases/index.test.js Co-authored-by: Aurélien Reeves <[email protected]> * Update test/Databases/index.test.js Co-authored-by: Aurélien Reeves <[email protected]> --------- Co-authored-by: Aurélien Reeves <[email protected]>
1 parent 0197b03 commit aeb6a5a

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

src/Databases/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ export default class Databases {
3333

3434
/**
3535
* Create a new database
36-
* @param addon_provider_id ID of the addon provider
37-
* @param plan_id ID of the plan
36+
* @param technology ID or slug of the technology (addon provider)
37+
* @param plan ID or name of the plan
3838
* @param name Name of the database
39-
*
4039
* @return Promise that when resolved returns the new database.
4140
*/
4241

src/models/regional/databases.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ export interface DatabaseProject {
1313
export interface DashboardDatabase {
1414
app: DatabaseAppDashboard;
1515
addon: DatabaseAddon;
16+
database: DatabaseObject;
1617
}
1718

1819
export interface Database {
1920
app: DatabaseApp;
2021
addon: DatabaseAddon;
22+
database: DatabaseObject;
2123
}
2224

2325
export interface DatabaseAppDashboard {
@@ -35,6 +37,7 @@ export interface DatabaseAppDashboard {
3537
addon_updated_at?: string;
3638
dedicated_database?: boolean;
3739
addon?: DatabaseAddon;
40+
database?: DatabaseObject;
3841
}
3942
export interface DatabaseApp {
4043
id: string;
@@ -84,6 +87,14 @@ export interface DatabaseAddon {
8487
hds_resource?: boolean;
8588
}
8689

90+
export interface DatabaseObject {
91+
id: string;
92+
name: string;
93+
project_id: string;
94+
technology: string;
95+
plan: string;
96+
}
97+
8798
export interface DatabaseAddonProvider {
8899
id: string;
89100
name: string;
@@ -100,10 +111,11 @@ export interface DatabaseAddonPlan {
100111
}
101112

102113
export interface CreateParams {
103-
/** ID of the addon provider */
104-
addon_provider_id: string;
105-
/** ID of the plan */
106-
plan_id: string;
114+
/**
115+
/** Technology ID or slug of the addon provider */
116+
technology?: string;
117+
/** Plan ID or name */
118+
plan?: string;
107119
/** Name of the database */
108120
name: string;
109121
/** ID of the project (optional) */

test/Databases/index.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ describe("Databases#create", () => {
2929
null,
3030
{
3131
database: {
32-
addon_provider_id: "provider-id",
33-
plan_id: "plan-id",
3432
name: "db-name",
33+
technology: "postgresql",
34+
plan: "sandbox",
3535
},
3636
},
3737
"apps",
3838
(client) => {
3939
return new Databases(client).create({
40-
addon_provider_id: "provider-id",
41-
plan_id: "plan-id",
40+
technology: "postgresql",
41+
plan: "sandbox",
4242
name: "db-name",
4343
});
4444
},

0 commit comments

Comments
 (0)