-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backend: Unifyed DB models into a unique table
- Loading branch information
Showing
9 changed files
with
136 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { RoomPreferences, AppearancePreferences } from '@openvidu/call-common-types'; | ||
import { Table, Column, Model, DataType } from 'sequelize-typescript'; | ||
|
||
type PreferencesMap = { | ||
roomPreferences: RoomPreferences; | ||
appearancePreferences: AppearancePreferences; | ||
}; | ||
|
||
type PreferencesKey = keyof PreferencesMap; | ||
type PreferencesValue<K extends PreferencesKey> = PreferencesMap[K]; | ||
|
||
@Table({ tableName: 'global_preferences' }) | ||
export class GlobalPreferencesModel<K extends PreferencesKey = PreferencesKey> extends Model { | ||
@Column({ | ||
type: DataType.STRING, | ||
allowNull: false, | ||
unique: true | ||
}) | ||
declare key: K; | ||
|
||
@Column({ | ||
type: DataType.JSON, | ||
allowNull: false | ||
}) | ||
declare value: PreferencesValue<K>; | ||
} |
10 changes: 0 additions & 10 deletions
10
backend/src/models/global-preferences/appearance-preference.model.ts
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
backend/src/models/global-preferences/room-preference.model.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.