diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-01-11 20:38:34 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-11 20:38:34 +0900 |
| commit | 6c975275f82c79eed2c7757d55283c95d23ca5b8 (patch) | |
| tree | 2871e4c3a1a67295ea5c3e19b9136ae79a17088c /src/models | |
| parent | fix context menu (diff) | |
| download | misskey-6c975275f82c79eed2c7757d55283c95d23ca5b8.tar.gz misskey-6c975275f82c79eed2c7757d55283c95d23ca5b8.tar.bz2 misskey-6c975275f82c79eed2c7757d55283c95d23ca5b8.zip | |
Registry (#7073)
* wip
* wip
* wip
* wip
* wip
* Update registry.value.vue
* wip
* wip
* wip
* wip
* typo
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/entities/registry-item.ts | 58 | ||||
| -rw-r--r-- | src/models/entities/user-profile.ts | 1 | ||||
| -rw-r--r-- | src/models/index.ts | 2 | ||||
| -rw-r--r-- | src/models/repositories/user.ts | 1 |
4 files changed, 61 insertions, 1 deletions
diff --git a/src/models/entities/registry-item.ts b/src/models/entities/registry-item.ts new file mode 100644 index 0000000000..54d2ef2082 --- /dev/null +++ b/src/models/entities/registry-item.ts @@ -0,0 +1,58 @@ +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { User } from './user'; +import { id } from '../id'; + +// TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい +@Entity() +export class RegistryItem { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the RegistryItem.' + }) + public createdAt: Date; + + @Column('timestamp with time zone', { + comment: 'The updated date of the RegistryItem.' + }) + public updatedAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The owner ID.' + }) + public userId: User['id']; + + @ManyToOne(type => User, { + onDelete: 'CASCADE' + }) + @JoinColumn() + public user: User | null; + + @Column('varchar', { + length: 1024, + comment: 'The key of the RegistryItem.' + }) + public key: string; + + @Column('jsonb', { + default: {}, nullable: true, + comment: 'The value of the RegistryItem.' + }) + public value: any | null; + + @Index() + @Column('varchar', { + length: 1024, array: true, default: '{}' + }) + public scope: string[]; + + // サードパーティアプリに開放するときのためのカラム + @Index() + @Column('varchar', { + length: 512, nullable: true + }) + public domain: string | null; +} diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts index 97a4150be0..0e2c660325 100644 --- a/src/models/entities/user-profile.ts +++ b/src/models/entities/user-profile.ts @@ -94,6 +94,7 @@ export class UserProfile { }) public password: string | null; + // TODO: そのうち消す @Column('jsonb', { default: {}, comment: 'The client-specific data of the User.' diff --git a/src/models/index.ts b/src/models/index.ts index dd05dcbcc6..213570a9c4 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -57,6 +57,7 @@ import { ChannelRepository } from './repositories/channel'; import { MutedNote } from './entities/muted-note'; import { ChannelFollowing } from './entities/channel-following'; import { ChannelNotePining } from './entities/channel-note-pining'; +import { RegistryItem } from './entities/registry-item'; export const Announcements = getRepository(Announcement); export const AnnouncementReads = getRepository(AnnouncementRead); @@ -116,3 +117,4 @@ export const MutedNotes = getRepository(MutedNote); export const Channels = getCustomRepository(ChannelRepository); export const ChannelFollowings = getRepository(ChannelFollowing); export const ChannelNotePinings = getRepository(ChannelNotePining); +export const RegistryItems = getRepository(RegistryItem); diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 29facf5239..7bf11b3167 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -261,7 +261,6 @@ export class UserRepository extends Repository<User> { } : {}), ...(opts.includeSecrets ? { - clientData: profile!.clientData, email: profile!.email, emailVerified: profile!.emailVerified, securityKeysList: profile!.twoFactorEnabled |