types
This commit is contained in:
parent
3332f2fa22
commit
8f165d5b68
|
@ -13,8 +13,6 @@ const EXCLUDED_EVENTS: Event[] = [
|
|||
Event.ROLE_UPDATED,
|
||||
Event.DATASOURCE_UPDATED,
|
||||
Event.QUERY_UPDATED,
|
||||
// Event.TABLE_UPDATED,
|
||||
// Event.VIEW_UPDATED,
|
||||
Event.VIEW_FILTER_UPDATED,
|
||||
Event.VIEW_CALCULATION_UPDATED,
|
||||
Event.AUTOMATION_TRIGGER_UPDATED,
|
||||
|
|
|
@ -30,7 +30,6 @@ async function created(view: ViewV2, timestamp?: string | number) {
|
|||
}
|
||||
|
||||
async function updated(newView: ViewV2) {
|
||||
// // check whether any of the fields are different
|
||||
let viewJoins = 0
|
||||
for (const key in newView.schema) {
|
||||
if (newView.schema[key]?.columns) {
|
||||
|
|
|
@ -65,27 +65,6 @@ export async function save(ctx: Ctx) {
|
|||
builderSocket?.emitTableUpdate(ctx, table)
|
||||
}
|
||||
|
||||
// export async function calculationEvents(existingView: View, newView: View) {
|
||||
// const existingCalculation = existingView && existingView.calculation
|
||||
// const newCalculation = newView && newView.calculation
|
||||
//
|
||||
// if (existingCalculation && !newCalculation) {
|
||||
// await events.view.calculationDeleted(existingView)
|
||||
// }
|
||||
//
|
||||
// if (!existingCalculation && newCalculation) {
|
||||
// await events.view.calculationCreated(newView)
|
||||
// }
|
||||
//
|
||||
// if (
|
||||
// existingCalculation &&
|
||||
// newCalculation &&
|
||||
// existingCalculation !== newCalculation
|
||||
// ) {
|
||||
// await events.view.calculationUpdated(newView)
|
||||
// }
|
||||
// }
|
||||
|
||||
export async function filterEvents(existingView: View, newView: View) {
|
||||
const hasExistingFilters = !!(
|
||||
existingView &&
|
||||
|
|
|
@ -7,24 +7,6 @@ export const backfill = async (appDb: Database, timestamp: string | number) => {
|
|||
|
||||
for (const table of tables) {
|
||||
await events.table.created(table, timestamp)
|
||||
|
||||
if (table.views) {
|
||||
for (const view of Object.values(table.views)) {
|
||||
if (sdk.views.isV2(view)) {
|
||||
continue
|
||||
}
|
||||
|
||||
// await events.view.created(view, timestamp)
|
||||
|
||||
if (view.calculation) {
|
||||
await events.view.calculationCreated(view, timestamp)
|
||||
}
|
||||
|
||||
if (view.filters?.length) {
|
||||
await events.view.filterCreated(view, timestamp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tables.length
|
||||
|
|
|
@ -63,7 +63,7 @@ export async function create(
|
|||
export async function update(
|
||||
tableId: string,
|
||||
view: Readonly<ViewV2>
|
||||
): Promise<{ view: ViewV2; existingView: ViewV2 }> {
|
||||
): Promise<{ view: Readonly<ViewV2>; existingView: ViewV2 }> {
|
||||
const db = context.getAppDB()
|
||||
|
||||
const { datasourceId, tableName } = breakExternalTableId(tableId)
|
||||
|
@ -87,7 +87,7 @@ export async function update(
|
|||
delete views[existingView.name]
|
||||
views[view.name] = view
|
||||
await db.put(ds)
|
||||
return { view, existingView }
|
||||
return { view, existingView } as { view: ViewV2; existingView: ViewV2 }
|
||||
}
|
||||
|
||||
export async function remove(viewId: string): Promise<ViewV2> {
|
||||
|
|
|
@ -76,7 +76,7 @@ export async function update(
|
|||
delete table.views[existingView.name]
|
||||
table.views[view.name] = view
|
||||
await db.put(table)
|
||||
return { view, existingView }
|
||||
return { view, existingView } as { view: ViewV2; existingView: ViewV2 }
|
||||
}
|
||||
|
||||
export async function remove(viewId: string): Promise<ViewV2> {
|
||||
|
|
Loading…
Reference in New Issue