alaska-banner
Advanced tools
Comparing version 0.11.22 to 0.12.0
@@ -1,6 +0,9 @@ | ||
// @flow | ||
'use strict'; | ||
export default { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = { | ||
prefix: '/banner', | ||
controllers: false | ||
}; | ||
}; |
14
index.js
@@ -1,6 +0,12 @@ | ||
import { Service } from 'alaska'; | ||
'use strict'; | ||
class BannerService extends Service { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _alaska = require('alaska'); | ||
class BannerService extends _alaska.Service { | ||
constructor(options) { | ||
options = options || {}; | ||
options = options || { dir: '', id: '' }; | ||
options.dir = options.dir || __dirname; | ||
@@ -12,2 +18,2 @@ options.id = options.id || 'alaska-banner'; | ||
export default new BannerService(); | ||
exports.default = new BannerService(); |
@@ -0,3 +1,7 @@ | ||
'use strict'; | ||
export default { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = { | ||
Banner: 'Banner', | ||
@@ -10,2 +14,2 @@ 'Start At': 'Start At', | ||
Clicks: 'Clicks' | ||
}; | ||
}; |
@@ -0,3 +1,7 @@ | ||
'use strict'; | ||
export default { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = { | ||
Banner: '广告图', | ||
@@ -10,2 +14,2 @@ 'Start At': '开始时间', | ||
Clicks: '点击次数' | ||
}; | ||
}; |
@@ -1,102 +0,11 @@ | ||
// @flow | ||
'use strict'; | ||
import { Model } from 'alaska'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
export default class Banner extends Model { | ||
static label = 'Banner'; | ||
static icon = 'picture-o'; | ||
static defaultSort = '-sort'; | ||
static defaultColumns = 'pic title position sort clicks activated startAt endAt'; | ||
static api = { | ||
list: 1 | ||
}; | ||
var _alaska = require('alaska'); | ||
static defaultFilters = (ctx) => { | ||
if (ctx.service.id === 'alaska-admin') return null; | ||
return { | ||
activated: true, | ||
startAt: { $lte: new Date() }, | ||
endAt: { $gte: new Date() } | ||
}; | ||
}; | ||
class Banner extends _alaska.Model { | ||
static fields = { | ||
title: { | ||
label: 'Title', | ||
type: String, | ||
required: true | ||
}, | ||
pic: { | ||
label: 'Picture', | ||
type: 'image' | ||
}, | ||
position: { | ||
label: 'Position', | ||
type: 'select', | ||
default: 'default', | ||
options: [{ | ||
label: 'Default', | ||
value: 'default' | ||
}] | ||
}, | ||
action: { | ||
label: 'Action', | ||
type: 'select', | ||
default: 'url', | ||
options: [{ | ||
label: 'URL', | ||
value: 'url' | ||
}] | ||
}, | ||
url: { | ||
label: 'URL', | ||
type: String | ||
}, | ||
sort: { | ||
label: 'Sort', | ||
type: Number, | ||
default: 0, | ||
private: true | ||
}, | ||
clicks: { | ||
label: 'Clicks', | ||
type: Number, | ||
default: 0, | ||
private: true | ||
}, | ||
activated: { | ||
label: 'Activated', | ||
type: Boolean, | ||
private: true | ||
}, | ||
startAt: { | ||
label: 'Start At', | ||
type: Date, | ||
private: true | ||
}, | ||
endAt: { | ||
label: 'End At', | ||
type: Date, | ||
private: true, | ||
index: true | ||
}, | ||
createdAt: { | ||
label: 'Created At', | ||
type: Date, | ||
private: true | ||
} | ||
}; | ||
title: string; | ||
pic: Object; | ||
position: string; | ||
action: string; | ||
url: string; | ||
sort: number; | ||
clicks: number; | ||
activated: boolean; | ||
startAt: Date; | ||
endAt: Date; | ||
createdAt: Date; | ||
preSave() { | ||
@@ -119,1 +28,85 @@ if (!this.startAt) { | ||
} | ||
exports.default = Banner; | ||
Banner.label = 'Banner'; | ||
Banner.icon = 'picture-o'; | ||
Banner.defaultSort = '-sort'; | ||
Banner.defaultColumns = 'pic title position sort clicks activated startAt endAt'; | ||
Banner.api = { | ||
list: 1 | ||
}; | ||
Banner.defaultFilters = ctx => { | ||
if (ctx.service.id === 'alaska-admin') return null; | ||
return { | ||
activated: true, | ||
startAt: { $lte: new Date() }, | ||
endAt: { $gte: new Date() } | ||
}; | ||
}; | ||
Banner.fields = { | ||
title: { | ||
label: 'Title', | ||
type: String, | ||
required: true | ||
}, | ||
pic: { | ||
label: 'Picture', | ||
type: 'image' | ||
}, | ||
position: { | ||
label: 'Position', | ||
type: 'select', | ||
default: 'default', | ||
options: [{ | ||
label: 'Default', | ||
value: 'default' | ||
}] | ||
}, | ||
action: { | ||
label: 'Action', | ||
type: 'select', | ||
default: 'url', | ||
options: [{ | ||
label: 'URL', | ||
value: 'url' | ||
}] | ||
}, | ||
url: { | ||
label: 'URL', | ||
type: String | ||
}, | ||
sort: { | ||
label: 'Sort', | ||
type: Number, | ||
default: 0, | ||
private: true | ||
}, | ||
clicks: { | ||
label: 'Clicks', | ||
type: Number, | ||
default: 0, | ||
private: true | ||
}, | ||
activated: { | ||
label: 'Activated', | ||
type: Boolean, | ||
private: true | ||
}, | ||
startAt: { | ||
label: 'Start At', | ||
type: Date, | ||
private: true | ||
}, | ||
endAt: { | ||
label: 'End At', | ||
type: Date, | ||
private: true, | ||
index: true | ||
}, | ||
createdAt: { | ||
label: 'Created At', | ||
type: Date, | ||
private: true | ||
} | ||
}; |
{ | ||
"name": "alaska-banner", | ||
"version": "0.11.22", | ||
"version": "0.12.0", | ||
"description": "Alaska banner service", | ||
@@ -9,6 +9,7 @@ "keywords": [ | ||
], | ||
"alaska": "service", | ||
"main": "index.js", | ||
"repository": "https://github.com/maichong/alaska/tree/master/packages/alaska-banner", | ||
"repository": "https://github.com/maichong/alaska/tree/master/src/alaska-banner", | ||
"author": "Liang <liang@maichong.it> (https://github.com/liangxingchen)", | ||
"license": "MIT" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4081
170