aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-05-31 14:02:26 +0200
committerChocobozzz <me@florianbigard.com>2019-05-31 14:49:31 +0200
commit57cfff78858b2360d9e038e2a504b761cb51da47 (patch)
tree28575a83f1680f9c40f04b8a71b4f2eb35f90400 /server/models
parent4c72c1cd411b4ff7ed054b584f184117bae91d5b (diff)
downloadPeerTube-57cfff78858b2360d9e038e2a504b761cb51da47.tar.gz
PeerTube-57cfff78858b2360d9e038e2a504b761cb51da47.tar.zst
PeerTube-57cfff78858b2360d9e038e2a504b761cb51da47.zip
Remove unused actor uuid field
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/account.ts19
-rw-r--r--server/models/activitypub/actor.ts14
-rw-r--r--server/models/video/video-channel.ts21
3 files changed, 2 insertions, 52 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 2b04acd86..09cada096 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -47,7 +47,7 @@ export enum ScopeNames {
47 attributes: [ 'id', 'name' ], 47 attributes: [ 'id', 'name' ],
48 include: [ 48 include: [
49 { 49 {
50 attributes: [ 'id', 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ], 50 attributes: [ 'id', 'preferredUsername', 'url', 'serverId', 'avatarId' ],
51 model: ActorModel.unscoped(), 51 model: ActorModel.unscoped(),
52 required: true, 52 required: true,
53 where: whereActor, 53 where: whereActor,
@@ -180,22 +180,6 @@ export class AccountModel extends Model<AccountModel> {
180 return AccountModel.findByPk(id, { transaction }) 180 return AccountModel.findByPk(id, { transaction })
181 } 181 }
182 182
183 static loadByUUID (uuid: string) {
184 const query = {
185 include: [
186 {
187 model: ActorModel,
188 required: true,
189 where: {
190 uuid
191 }
192 }
193 ]
194 }
195
196 return AccountModel.findOne(query)
197 }
198
199 static loadByNameWithHost (nameWithHost: string) { 183 static loadByNameWithHost (nameWithHost: string) {
200 const [ accountName, host ] = nameWithHost.split('@') 184 const [ accountName, host ] = nameWithHost.split('@')
201 185
@@ -332,7 +316,6 @@ export class AccountModel extends Model<AccountModel> {
332 316
333 return { 317 return {
334 id: this.id, 318 id: this.id,
335 uuid: actor.uuid,
336 name: actor.name, 319 name: actor.name,
337 displayName: this.getDisplayName(), 320 displayName: this.getDisplayName(),
338 url: actor.url, 321 url: actor.url,
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 4a466441c..bd6a2c8fd 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -7,13 +7,11 @@ import {
7 Column, 7 Column,
8 CreatedAt, 8 CreatedAt,
9 DataType, 9 DataType,
10 Default,
11 DefaultScope, 10 DefaultScope,
12 ForeignKey, 11 ForeignKey,
13 HasMany, 12 HasMany,
14 HasOne, 13 HasOne,
15 Is, 14 Is,
16 IsUUID,
17 Model, 15 Model,
18 Scopes, 16 Scopes,
19 Table, 17 Table,
@@ -120,10 +118,6 @@ export const unusedActorAttributesForAPI = [
120 fields: [ 'avatarId' ] 118 fields: [ 'avatarId' ]
121 }, 119 },
122 { 120 {
123 fields: [ 'uuid' ],
124 unique: true
125 },
126 {
127 fields: [ 'followersUrl' ] 121 fields: [ 'followersUrl' ]
128 } 122 }
129 ] 123 ]
@@ -135,12 +129,6 @@ export class ActorModel extends Model<ActorModel> {
135 type: ActivityPubActorType 129 type: ActivityPubActorType
136 130
137 @AllowNull(false) 131 @AllowNull(false)
138 @Default(DataType.UUIDV4)
139 @IsUUID(4)
140 @Column(DataType.UUID)
141 uuid: string
142
143 @AllowNull(false)
144 @Is('ActorPreferredUsername', value => throwIfNotValid(value, isActorPreferredUsernameValid, 'actor preferred username')) 132 @Is('ActorPreferredUsername', value => throwIfNotValid(value, isActorPreferredUsernameValid, 'actor preferred username'))
145 @Column 133 @Column
146 preferredUsername: string 134 preferredUsername: string
@@ -408,7 +396,6 @@ export class ActorModel extends Model<ActorModel> {
408 return { 396 return {
409 id: this.id, 397 id: this.id,
410 url: this.url, 398 url: this.url,
411 uuid: this.uuid,
412 name: this.preferredUsername, 399 name: this.preferredUsername,
413 host: this.getHost(), 400 host: this.getHost(),
414 hostRedundancyAllowed: this.getRedundancyAllowed(), 401 hostRedundancyAllowed: this.getRedundancyAllowed(),
@@ -454,7 +441,6 @@ export class ActorModel extends Model<ActorModel> {
454 endpoints: { 441 endpoints: {
455 sharedInbox: this.sharedInboxUrl 442 sharedInbox: this.sharedInboxUrl
456 }, 443 },
457 uuid: this.uuid,
458 publicKey: { 444 publicKey: {
459 id: this.getPublicKeyUrl(), 445 id: this.getPublicKeyUrl(),
460 owner: this.url, 446 owner: this.url,
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index d73be18d6..b0b261c88 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -72,7 +72,7 @@ type AvailableForListOptions = {
72 attributes: [ 'name', 'description', 'id', 'actorId' ], 72 attributes: [ 'name', 'description', 'id', 'actorId' ],
73 include: [ 73 include: [
74 { 74 {
75 attributes: [ 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ], 75 attributes: [ 'preferredUsername', 'url', 'serverId', 'avatarId' ],
76 model: ActorModel.unscoped(), 76 model: ActorModel.unscoped(),
77 required: true, 77 required: true,
78 include: [ 78 include: [
@@ -387,24 +387,6 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
387 .findByPk(id) 387 .findByPk(id)
388 } 388 }
389 389
390 static loadByUUIDAndPopulateAccount (uuid: string) {
391 const query = {
392 include: [
393 {
394 model: ActorModel,
395 required: true,
396 where: {
397 uuid
398 }
399 }
400 ]
401 }
402
403 return VideoChannelModel
404 .scope([ ScopeNames.WITH_ACCOUNT ])
405 .findOne(query)
406 }
407
408 static loadByUrlAndPopulateAccount (url: string) { 390 static loadByUrlAndPopulateAccount (url: string) {
409 const query = { 391 const query = {
410 include: [ 392 include: [
@@ -510,7 +492,6 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
510 492
511 return { 493 return {
512 id: this.id, 494 id: this.id,
513 uuid: actor.uuid,
514 name: actor.name, 495 name: actor.name,
515 displayName: this.getDisplayName(), 496 displayName: this.getDisplayName(),
516 url: actor.url, 497 url: actor.url,