File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import * as util from './util'; // eslint-disable-line import/no-namespace
2222import Bookshelf from '@metabrainz/bookshelf' ;
2323import achievementType from './models/achievementType' ;
2424import achievementUnlock from './models/achievementUnlock' ;
25+ import adminLog from './models/adminLog' ;
2526import alias from './models/alias' ;
2627import aliasSet from './models/aliasSet' ;
2728import annotation from './models/annotation' ;
@@ -117,6 +118,7 @@ export default function init(config) {
117118 return {
118119 AchievementType : achievementType ( bookshelf ) ,
119120 AchievementUnlock : achievementUnlock ( bookshelf ) ,
121+ AdminLog : adminLog ( bookshelf ) ,
120122 Alias : alias ( bookshelf ) ,
121123 AliasSet : aliasSet ( bookshelf ) ,
122124 Annotation : annotation ( bookshelf ) ,
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2023 Shivam Awasthi
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; either version 2 of the License, or
7+ * (at your option) any later version.
8+ *
9+ * This program is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ * GNU General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU General Public License along
15+ * with this program; if not, write to the Free Software Foundation, Inc.,
16+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17+ */
18+
19+
20+ import { camelToSnake , snakeToCamel } from '../util' ;
21+
22+
23+ export default function adminLog ( bookshelf ) {
24+ const AdminLog = bookshelf . Model . extend ( {
25+ admin ( ) {
26+ return this . belongsTo ( 'Editor' , 'admin_id' ) ;
27+ } ,
28+ format : camelToSnake ,
29+ idAttribute : 'id' ,
30+ parse : snakeToCamel ,
31+ tableName : 'bookbrainz.admin_log' ,
32+ targetUser ( ) {
33+ return this . belongsTo ( 'Editor' , 'target_user_id' ) ;
34+ }
35+ } ) ;
36+
37+ return bookshelf . model ( 'AdminLog' , AdminLog ) ;
38+ }
39+
You can’t perform that action at this time.
0 commit comments