summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/entities
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-01-12 21:02:26 +0900
committerGitHub <noreply@github.com>2023-01-12 21:02:26 +0900
commit2470afaa2e200fb2fc748e0f8eef5e2c215369b6 (patch)
treec270452679996127a9d15c4ba5f97b39bb9ba560 /packages/backend/src/models/entities
parentUpdate CHANGELOG.md (diff)
downloadmisskey-2470afaa2e200fb2fc748e0f8eef5e2c215369b6.tar.gz
misskey-2470afaa2e200fb2fc748e0f8eef5e2c215369b6.tar.bz2
misskey-2470afaa2e200fb2fc748e0f8eef5e2c215369b6.zip
Role (#9437)
* wip * Update CHANGELOG.md * wip * wip * wip * Update create.ts * wip * wip * Update CHANGELOG.md * wip * wip * wip * wip * wip * wip * wip * Update CHANGELOG.md * wip * wip * Update delete.ts * Update delete.ts * wip * wip * wip * Update account-info.vue * wip * wip * Update settings.vue * Update user-info.vue * wip * Update show-file.ts * Update show-user.ts * wip * wip * Update delete.ts * wip * wip * Update overview.moderators.vue * Create 1673500412259-Role.js * wip * wip * Update roles.vue * 色 * Update roles.vue * integrate silence * wip * wip
Diffstat (limited to 'packages/backend/src/models/entities')
-rw-r--r--packages/backend/src/models/entities/Meta.ts21
-rw-r--r--packages/backend/src/models/entities/Role.ts66
-rw-r--r--packages/backend/src/models/entities/RoleAssignment.ts42
-rw-r--r--packages/backend/src/models/entities/User.ts22
4 files changed, 115 insertions, 36 deletions
diff --git a/packages/backend/src/models/entities/Meta.ts b/packages/backend/src/models/entities/Meta.ts
index fb25e370d2..0d65a8d17a 100644
--- a/packages/backend/src/models/entities/Meta.ts
+++ b/packages/backend/src/models/entities/Meta.ts
@@ -45,16 +45,6 @@ export class Meta {
@Column('boolean', {
default: false,
})
- public disableLocalTimeline: boolean;
-
- @Column('boolean', {
- default: false,
- })
- public disableGlobalTimeline: boolean;
-
- @Column('boolean', {
- default: false,
- })
public useStarForReactionFallback: boolean;
@Column('varchar', {
@@ -228,12 +218,6 @@ export class Meta {
public enableSensitiveMediaDetectionForVideos: boolean;
@Column('integer', {
- default: 1024,
- comment: 'Drive capacity of a local user (MB)',
- })
- public localDriveCapacityMb: number;
-
- @Column('integer', {
default: 32,
comment: 'Drive capacity of a remote user (MB)',
})
@@ -476,4 +460,9 @@ export class Meta {
default: true,
})
public enableActiveEmailValidation: boolean;
+
+ @Column('jsonb', {
+ default: { },
+ })
+ public defaultRoleOverride: Record<string, any>;
}
diff --git a/packages/backend/src/models/entities/Role.ts b/packages/backend/src/models/entities/Role.ts
new file mode 100644
index 0000000000..34dbc2ce41
--- /dev/null
+++ b/packages/backend/src/models/entities/Role.ts
@@ -0,0 +1,66 @@
+import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
+import { id } from '../id.js';
+
+@Entity()
+export class Role {
+ @PrimaryColumn(id())
+ public id: string;
+
+ @Column('timestamp with time zone', {
+ comment: 'The created date of the Role.',
+ })
+ public createdAt: Date;
+
+ @Column('timestamp with time zone', {
+ comment: 'The updated date of the Role.',
+ })
+ public updatedAt: Date;
+
+ @Column('timestamp with time zone', {
+ comment: 'The last used date of the Role.',
+ })
+ public lastUsedAt: Date;
+
+ @Column('varchar', {
+ length: 256,
+ })
+ public name: string;
+
+ @Column('varchar', {
+ length: 1024,
+ })
+ public description: string;
+
+ @Column('varchar', {
+ length: 256, nullable: true,
+ })
+ public color: string | null;
+
+ @Column('boolean', {
+ default: false,
+ })
+ public isPublic: boolean;
+
+ @Column('boolean', {
+ default: false,
+ })
+ public isModerator: boolean;
+
+ @Column('boolean', {
+ default: false,
+ })
+ public isAdministrator: boolean;
+
+ @Column('boolean', {
+ default: false,
+ })
+ public canEditMembersByModerator: boolean;
+
+ @Column('jsonb', {
+ default: { },
+ })
+ public options: Record<string, {
+ useDefault: boolean;
+ value: any;
+ }>;
+}
diff --git a/packages/backend/src/models/entities/RoleAssignment.ts b/packages/backend/src/models/entities/RoleAssignment.ts
new file mode 100644
index 0000000000..e86f2a8999
--- /dev/null
+++ b/packages/backend/src/models/entities/RoleAssignment.ts
@@ -0,0 +1,42 @@
+import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
+import { id } from '../id.js';
+import { Role } from './Role.js';
+import { User } from './User.js';
+
+@Entity()
+@Index(['userId', 'roleId'], { unique: true })
+export class RoleAssignment {
+ @PrimaryColumn(id())
+ public id: string;
+
+ @Column('timestamp with time zone', {
+ comment: 'The created date of the RoleAssignment.',
+ })
+ public createdAt: Date;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The user ID.',
+ })
+ public userId: User['id'];
+
+ @ManyToOne(type => User, {
+ onDelete: 'CASCADE',
+ })
+ @JoinColumn()
+ public user: User | null;
+
+ @Index()
+ @Column({
+ ...id(),
+ comment: 'The role ID.',
+ })
+ public roleId: Role['id'];
+
+ @ManyToOne(type => Role, {
+ onDelete: 'CASCADE',
+ })
+ @JoinColumn()
+ public role: Role | null;
+}
diff --git a/packages/backend/src/models/entities/User.ts b/packages/backend/src/models/entities/User.ts
index 73736f0150..8bd5c9700d 100644
--- a/packages/backend/src/models/entities/User.ts
+++ b/packages/backend/src/models/entities/User.ts
@@ -114,12 +114,6 @@ export class User {
@Column('boolean', {
default: false,
- comment: 'Whether the User is silenced.',
- })
- public isSilenced: boolean;
-
- @Column('boolean', {
- default: false,
comment: 'Whether the User is locked.',
})
public isLocked: boolean;
@@ -138,15 +132,9 @@ export class User {
@Column('boolean', {
default: false,
- comment: 'Whether the User is the admin.',
- })
- public isAdmin: boolean;
-
- @Column('boolean', {
- default: false,
- comment: 'Whether the User is a moderator.',
+ comment: 'Whether the User is the root.',
})
- public isModerator: boolean;
+ public isRoot: boolean;
@Index()
@Column('boolean', {
@@ -218,12 +206,6 @@ export class User {
})
public token: string | null;
- @Column('integer', {
- nullable: true,
- comment: 'Overrides user drive capacity limit',
- })
- public driveCapacityOverrideMb: number | null;
-
constructor(data: Partial<User>) {
if (data == null) return;