feat: plugins v1
This commit is contained in:
35
server/src/entities/PluginDataEntity.ts
Normal file
35
server/src/entities/PluginDataEntity.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
PrimaryColumn
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity('plugin_data')
|
||||
export class PluginDataEntity {
|
||||
@PrimaryColumn('text')
|
||||
serverId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
pluginId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
scope!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
ownerId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
key!: string;
|
||||
|
||||
@Column('text')
|
||||
valueJson!: string;
|
||||
|
||||
@Column('integer', { default: 1 })
|
||||
schemaVersion!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
updatedBy!: string | null;
|
||||
|
||||
@Column('integer')
|
||||
updatedAt!: number;
|
||||
}
|
||||
38
server/src/entities/PluginUserMetadataEntity.ts
Normal file
38
server/src/entities/PluginUserMetadataEntity.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
PrimaryColumn
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity('plugin_user_metadata')
|
||||
export class PluginUserMetadataEntity {
|
||||
@PrimaryColumn('text')
|
||||
serverId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
pluginId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
pluginUserId!: string;
|
||||
|
||||
@Column('text')
|
||||
displayName!: string;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
avatarHash!: string | null;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
avatarMime!: string | null;
|
||||
|
||||
@Column('integer', { nullable: true })
|
||||
avatarUpdatedAt!: number | null;
|
||||
|
||||
@Column('text')
|
||||
roleIdsJson!: string;
|
||||
|
||||
@Column('integer')
|
||||
createdAt!: number;
|
||||
|
||||
@Column('integer')
|
||||
updatedAt!: number;
|
||||
}
|
||||
41
server/src/entities/ServerPluginEventDefinitionEntity.ts
Normal file
41
server/src/entities/ServerPluginEventDefinitionEntity.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
PrimaryColumn
|
||||
} from 'typeorm';
|
||||
|
||||
export type ServerPluginEventDirection = 'clientToServer' | 'serverRelay' | 'p2pHint';
|
||||
export type ServerPluginEventScope = 'server' | 'channel' | 'user' | 'plugin';
|
||||
|
||||
@Entity('server_plugin_event_definitions')
|
||||
export class ServerPluginEventDefinitionEntity {
|
||||
@PrimaryColumn('text')
|
||||
serverId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
pluginId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
eventName!: string;
|
||||
|
||||
@Column('text')
|
||||
direction!: ServerPluginEventDirection;
|
||||
|
||||
@Column('text')
|
||||
scope!: ServerPluginEventScope;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
schemaJson!: string | null;
|
||||
|
||||
@Column('integer')
|
||||
maxPayloadBytes!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
rateLimitJson!: string | null;
|
||||
|
||||
@Column('integer')
|
||||
createdAt!: number;
|
||||
|
||||
@Column('integer')
|
||||
updatedAt!: number;
|
||||
}
|
||||
36
server/src/entities/ServerPluginRequirementEntity.ts
Normal file
36
server/src/entities/ServerPluginRequirementEntity.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
Index,
|
||||
PrimaryColumn
|
||||
} from 'typeorm';
|
||||
|
||||
export type ServerPluginRequirementStatus = 'required' | 'optional' | 'recommended' | 'blocked' | 'incompatible';
|
||||
|
||||
@Entity('server_plugin_requirements')
|
||||
export class ServerPluginRequirementEntity {
|
||||
@PrimaryColumn('text')
|
||||
serverId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
pluginId!: string;
|
||||
|
||||
@Index()
|
||||
@Column('text')
|
||||
status!: ServerPluginRequirementStatus;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
versionRange!: string | null;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
reason!: string | null;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
configuredBy!: string | null;
|
||||
|
||||
@Column('integer')
|
||||
createdAt!: number;
|
||||
|
||||
@Column('integer')
|
||||
updatedAt!: number;
|
||||
}
|
||||
26
server/src/entities/ServerPluginSettingsEntity.ts
Normal file
26
server/src/entities/ServerPluginSettingsEntity.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
PrimaryColumn
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity('server_plugin_settings')
|
||||
export class ServerPluginSettingsEntity {
|
||||
@PrimaryColumn('text')
|
||||
serverId!: string;
|
||||
|
||||
@PrimaryColumn('text')
|
||||
pluginId!: string;
|
||||
|
||||
@Column('text')
|
||||
settingsJson!: string;
|
||||
|
||||
@Column('integer', { default: 1 })
|
||||
schemaVersion!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
updatedBy!: string | null;
|
||||
|
||||
@Column('integer')
|
||||
updatedAt!: number;
|
||||
}
|
||||
@@ -10,3 +10,10 @@ export { ServerMembershipEntity } from './ServerMembershipEntity';
|
||||
export { ServerInviteEntity } from './ServerInviteEntity';
|
||||
export { ServerBanEntity } from './ServerBanEntity';
|
||||
export { GameMatchMissEntity } from './GameMatchMissEntity';
|
||||
export { ServerPluginRequirementEntity } from './ServerPluginRequirementEntity';
|
||||
export type { ServerPluginRequirementStatus } from './ServerPluginRequirementEntity';
|
||||
export { ServerPluginEventDefinitionEntity } from './ServerPluginEventDefinitionEntity';
|
||||
export type { ServerPluginEventDirection, ServerPluginEventScope } from './ServerPluginEventDefinitionEntity';
|
||||
export { PluginDataEntity } from './PluginDataEntity';
|
||||
export { ServerPluginSettingsEntity } from './ServerPluginSettingsEntity';
|
||||
export { PluginUserMetadataEntity } from './PluginUserMetadataEntity';
|
||||
|
||||
Reference in New Issue
Block a user