@@ -8,52 +8,60 @@ import {
88}  from  '@fastgpt/global/support/user/team/constant' ; 
99import  {  UsageCollectionName ,  UsageItemCollectionName  }  from  './constants' ; 
1010
11- const  UsageSchema  =  new  Schema ( { 
12-   teamId : { 
13-     type : Schema . Types . ObjectId , 
14-     ref : TeamCollectionName , 
15-     required : true 
16-   } , 
17-   tmbId : { 
18-     type : Schema . Types . ObjectId , 
19-     ref : TeamMemberCollectionName , 
20-     required : true 
21-   } , 
22-   source : { 
23-     type : String , 
24-     enum : Object . values ( UsageSourceEnum ) , 
25-     required : true 
26-   } , 
27-   appName : { 
28-     // usage name 
29-     type : String , 
30-     default : '' 
31-   } , 
32-   totalPoints : { 
33-     // total points 
34-     type : Number , 
35-     required : true 
36-   } , 
37-   appId : { 
38-     type : Schema . Types . ObjectId , 
39-     ref : 'apps' , 
40-     required : false 
41-   } , 
42-   pluginId : { 
43-     type : Schema . Types . ObjectId , 
44-     ref : 'plugins' , 
45-     required : false 
46-   } , 
47-   time : { 
48-     type : Date , 
49-     default : ( )  =>  new  Date ( ) 
50-   } , 
11+ const  UsageSchema  =  new  Schema ( 
12+   { 
13+     teamId : { 
14+       type : Schema . Types . ObjectId , 
15+       ref : TeamCollectionName , 
16+       required : true 
17+     } , 
18+     tmbId : { 
19+       type : Schema . Types . ObjectId , 
20+       ref : TeamMemberCollectionName , 
21+       required : true 
22+     } , 
23+     source : { 
24+       type : String , 
25+       enum : Object . values ( UsageSourceEnum ) , 
26+       required : true 
27+     } , 
28+     appName : { 
29+       // usage name 
30+       type : String , 
31+       default : '' 
32+     } , 
33+     totalPoints : { 
34+       // total points 
35+       type : Number , 
36+       required : true 
37+     } , 
38+     appId : { 
39+       type : Schema . Types . ObjectId , 
40+       ref : 'apps' , 
41+       required : false 
42+     } , 
43+     pluginId : { 
44+       type : Schema . Types . ObjectId , 
45+       ref : 'plugins' , 
46+       required : false 
47+     } , 
48+     time : { 
49+       type : Date , 
50+       default : ( )  =>  new  Date ( ) 
51+     } , 
5152
52-   // @description  It will not be used again in the future. 
53-   list : { 
54-     type : Array 
53+     // @description  It will not be used again in the future. 
54+     list : { 
55+       type : Array 
56+     } 
57+   } , 
58+   { 
59+     // Auto update time 
60+     timestamps : { 
61+       updatedAt : 'time' 
62+     } 
5563  } 
56- } ) ; 
64+ ) ; 
5765
5866UsageSchema . virtual ( 'usageItems' ,  { 
5967  ref : UsageItemCollectionName , 
0 commit comments