universo-platform-3d

Форк
0
78 строк · 1.5 Кб
1
import * as mongoose from 'mongoose'
2
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
3
import { ApiProperty } from '@nestjs/swagger'
4

5
export type UserRecentsDocument = UserRecents & Document
6

7
export interface IUserRecents {
8
  spaces?: string[]
9
  assets?: IUserRecentsAssets
10
  scripts?: string[]
11
}
12

13
interface IUserRecentsAssets {
14
  instanced: string[]
15
}
16

17
@Schema({
18
  timestamps: false,
19
  toJSON: {
20
    virtuals: true
21
  },
22
  _id: false
23
})
24
export class UserRecentAssets {
25
  @Prop({
26
    type: [mongoose.Schema.Types.ObjectId],
27
    default: [],
28
    ref: 'Asset',
29
    select: false
30
  })
31
  @ApiProperty({
32
    description: 'A list of 10 user`s recent assets'
33
  })
34
  instanced?: string[]
35
}
36

37
export const UserRecentAssetsSchema =
38
  SchemaFactory.createForClass(UserRecentAssets)
39

40
@Schema({
41
  timestamps: false,
42
  toJSON: {
43
    virtuals: true
44
  },
45
  _id: false
46
})
47
export class UserRecents {
48
  @Prop({
49
    type: [mongoose.Schema.Types.ObjectId],
50
    default: [],
51
    ref: 'Space',
52
    select: false
53
  })
54
  @ApiProperty({
55
    description: 'A list of 10 user`s recent spaces'
56
  })
57
  spaces?: string[]
58

59
  @Prop({
60
    default: {},
61
    type: UserRecentAssets
62
  })
63
  @ApiProperty()
64
  assets: UserRecentAssets
65

66
  @Prop({
67
    type: [mongoose.Schema.Types.ObjectId],
68
    default: [],
69
    ref: 'ScriptEntity',
70
    select: false
71
  })
72
  @ApiProperty({
73
    description: 'A list of 10 user`s recent scripts'
74
  })
75
  scripts?: string[]
76
}
77

78
export const UserRecentsSchema = SchemaFactory.createForClass(UserRecents)
79

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.