Skip to content

Commit

Permalink
Add new scope (#156)
Browse files Browse the repository at this point in the history
* Add new scope

* Recreate migration with script

* Add migration config

* Fixed return
  • Loading branch information
artemipanchuk authored Jul 15, 2024
1 parent 58c9680 commit e4f85d3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/const/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const ALLOWED_SCOPE_VALUES = [
'connection',
'widget',
'config',
'presentation',
];

export const ID_VARIABLES = [
Expand Down
15 changes: 15 additions & 0 deletions src/db/migrations/20240715094819_add_scope_presentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {Knex} from 'knex';

export async function up(knex: Knex): Promise<void> {
return knex.raw(`
ALTER TYPE scope ADD VALUE 'presentation';
`);
}

export async function down(knex: Knex): Promise<void> {
return knex.raw('');
}

export const config = {
transaction: false,
};
2 changes: 1 addition & 1 deletion src/services/entry/actions/create-in-workbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const validateCreateEntryInWorkbook = makeSchemaValidator({
},
scope: {
type: 'string',
enum: ['connection', 'dataset', 'dash', 'widget'],
enum: ['connection', 'dataset', 'dash', 'widget', 'presentation'],
},
type: {
type: 'string',
Expand Down

0 comments on commit e4f85d3

Please sign in to comment.