@@ -45,13 +45,16 @@ module.exports = {
4545 }
4646 }
4747 } ,
48- name : { type : DataTypes . STRING }
48+ name : { type : DataTypes . STRING } ,
49+ readOnly : { type : DataTypes . BOOLEAN , defaultValue : false , allowNull : false } ,
50+ adminOptIn : { type : DataTypes . BOOLEAN , defaultValue : false , allowNull : false }
4951 } ,
5052 associations : function ( M ) {
5153 this . belongsTo ( M . Team , { foreignKey : 'ownerId' , constraints : false } )
5254 this . belongsTo ( M . Project , { foreignKey : 'ownerId' , constraints : false } )
5355 this . belongsTo ( M . Device , { foreignKey : 'ownerId' , constraints : false } )
5456 this . belongsTo ( M . User , { foreignKey : 'ownerId' , constraints : false } )
57+ this . hasMany ( M . AccessTokenTeamScope )
5558 } ,
5659 finders : function ( M ) {
5760 return {
@@ -112,7 +115,14 @@ module.exports = {
112115 name : { [ Op . ne ] : null }
113116 } ,
114117 order : [ [ 'id' , 'ASC' ] ] ,
115- attributes : [ 'id' , 'name' , 'scope' , 'expiresAt' ]
118+ attributes : [ 'id' , 'name' , 'scope' , 'expiresAt' , 'readOnly' , 'adminOptIn' ] ,
119+ include : [ {
120+ model : M . AccessTokenTeamScope ,
121+ include : [ {
122+ model : M . Team ,
123+ attributes : [ 'id' , 'name' ]
124+ } ]
125+ } ]
116126 } )
117127 return tokens
118128 } ,
0 commit comments