hippo-fw 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +16 -11
- data/Rakefile +0 -7
- data/bin/hippo +5 -1
- data/client/hippo/__mocks__/config.js +2 -3
- data/client/hippo/boot.jsx +0 -2
- data/client/hippo/components/asset.jsx +1 -1
- data/client/hippo/components/form.jsx +8 -4
- data/client/hippo/components/form/fields.jsx +28 -14
- data/client/hippo/components/form/model.js +65 -20
- data/client/hippo/components/form/wrapper.jsx +11 -5
- data/client/hippo/components/icon.jsx +1 -1
- data/client/hippo/components/master-detail.jsx +66 -0
- data/client/hippo/components/master-detail.scss +50 -0
- data/client/hippo/components/record-finder.jsx +5 -5
- data/client/hippo/components/tool-tip.jsx +20 -0
- data/client/hippo/config.js +5 -3
- data/client/hippo/extensions/base.js +4 -0
- data/client/hippo/lib/smooth-scroll.js +17 -16
- data/client/hippo/models/asset.js +8 -10
- data/client/hippo/models/collection.js +1 -4
- data/client/hippo/models/query/array-result.js +11 -9
- data/client/hippo/models/sync.js +3 -3
- data/client/hippo/models/tenant.js +29 -0
- data/client/hippo/screens/system-settings.jsx +5 -4
- data/client/hippo/screens/system-settings/mailer-config.jsx +11 -17
- data/client/hippo/screens/system-settings/tenant.jsx +90 -0
- data/client/hippo/screens/user-management/edit-form.jsx +15 -25
- data/client/hippo/testing/index.js +1 -0
- data/client/hippo/workspace/styles.scss +0 -23
- data/command-reference-files/initial/.babelrc +10 -8
- data/command-reference-files/initial/Gemfile +1 -1
- data/{views/index.html → command-reference-files/initial/views/index.erb} +1 -0
- data/config/routes.rb +48 -17
- data/config/webpack.config.js +7 -12
- data/db/migrate/01_create_tenants.rb +13 -0
- data/db/migrate/{01_create_system_settings.rb → 02_create_system_settings.rb} +2 -1
- data/db/migrate/{02_create_assets.rb → 03_create_assets.rb} +2 -4
- data/db/migrate/{20140615031600_create_users.rb → 04_create_users.rb} +4 -2
- data/db/seed.rb +10 -1
- data/hippo-fw.gemspec +53 -51
- data/lib/hippo.rb +7 -1
- data/lib/hippo/access.rb +0 -1
- data/lib/hippo/access/roles/basic_user.rb +2 -0
- data/lib/hippo/api.rb +4 -3
- data/lib/hippo/{access → api}/authentication_provider.rb +3 -1
- data/lib/hippo/api/controller_base.rb +2 -2
- data/lib/hippo/api/handlers/asset.rb +28 -2
- data/lib/hippo/api/handlers/tenant.rb +26 -0
- data/lib/hippo/api/helper_methods.rb +5 -13
- data/lib/hippo/api/request_wrapper.rb +8 -1
- data/lib/hippo/api/root.rb +50 -51
- data/lib/hippo/api/route_set.rb +101 -0
- data/lib/hippo/api/routing.rb +9 -98
- data/lib/hippo/api/tenant_domain_router.rb +21 -0
- data/lib/hippo/asset.rb +1 -0
- data/lib/hippo/command.rb +1 -24
- data/lib/hippo/command/app.rb +4 -3
- data/lib/hippo/command/console.rb +7 -0
- data/lib/hippo/command/generate.rb +0 -5
- data/lib/hippo/command/guard.rb +1 -0
- data/lib/hippo/command/jest.rb +2 -2
- data/lib/hippo/command/server.rb +1 -3
- data/lib/hippo/command/webpack.rb +6 -26
- data/lib/hippo/configuration.rb +21 -13
- data/lib/hippo/db.rb +2 -0
- data/lib/hippo/db/migrations.rb +9 -2
- data/lib/hippo/extension.rb +49 -14
- data/lib/hippo/extension/definition.rb +0 -4
- data/lib/hippo/guard_tasks.rb +3 -11
- data/lib/hippo/mailer.rb +28 -16
- data/lib/hippo/model.rb +10 -0
- data/lib/hippo/numbers.rb +1 -1
- data/lib/hippo/rake_tasks.rb +7 -1
- data/lib/hippo/spec_helper.rb +33 -11
- data/lib/hippo/system_settings.rb +1 -0
- data/lib/hippo/templates/base.rb +1 -1
- data/lib/hippo/templates/mail.rb +26 -0
- data/lib/hippo/templates/tenant_change.rb +23 -0
- data/lib/hippo/tenant.rb +53 -0
- data/lib/hippo/user.rb +12 -6
- data/lib/hippo/version.rb +1 -1
- data/lib/hippo/webpack.rb +57 -0
- data/lib/hippo/{command → webpack}/client_config.rb +7 -21
- data/package.json +3 -3
- data/spec/client/components/__snapshots__/master-detail.spec.jsx.snap +22 -0
- data/spec/client/components/form.spec.jsx +14 -14
- data/spec/client/components/master-detail.spec.jsx +24 -0
- data/spec/client/components/record-finder.spec.jsx +5 -2
- data/spec/client/models/asset.spec.js +2 -13
- data/spec/client/models/base.spec.js +1 -11
- data/spec/client/models/query.spec.js +2 -4
- data/spec/client/models/sync.spec.js +7 -0
- data/spec/client/screens/__snapshots__/system-settings.spec.jsx.snap +79 -0
- data/spec/client/screens/system-settings-tenants.spec.jsx +18 -0
- data/spec/client/workspace/__snapshots__/menu.spec.jsx.snap +29 -313
- data/spec/client/workspace/menu.spec.jsx +1 -9
- data/spec/factories/tenant.rb +13 -0
- data/spec/fixtures/mail/test_email.liquid +1 -0
- data/spec/fixtures/{test_printer.tex → test_printer.tex.erb} +0 -0
- data/spec/server/api/controller_base_spec.rb +1 -1
- data/spec/server/api/tenant_change_spec.rb +24 -0
- data/spec/server/api/tenant_isolation_spec.rb +37 -0
- data/spec/server/asset_spec.rb +6 -6
- data/spec/server/command_spec.rb +0 -5
- data/spec/server/mailer_spec.rb +25 -23
- data/spec/server/numbers_spec.rb +12 -13
- data/spec/server/print/form_spec.rb +2 -1
- data/spec/server/strings_spec.rb +13 -13
- data/templates/.babelrc +10 -8
- data/templates/js/screen-definitions.js +8 -10
- data/templates/mail/tenant_change.liquid +13 -0
- data/{command-reference-files/initial/views/index.html → views/index.erb} +5 -2
- data/yarn.lock +22 -169
- metadata +56 -30
- data/client/hippo/components/form/field-prop-type.js +0 -16
- data/lib/hippo/api/default_routes.rb +0 -38
- data/lib/hippo/command/generate_component.rb +0 -28
- data/lib/hippo/command/generate_component.usage +0 -11
- data/lib/hippo/command/webpack_view.rb +0 -32
- data/lib/hippo/multi_server_boot.rb +0 -26
- data/lib/hippo/reloadable_view.rb +0 -13
- data/templates/client/components/.gitkeep +0 -0
- data/templates/client/components/BaseComponent.coffee +0 -9
- data/templates/client/components/Component.cjsx +0 -4
- data/templates/client/components/template.html +0 -3
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { observer } from 'mobx-react';
|
4
|
+
import { observable } from 'mobx';
|
5
|
+
import { Row, Col } from 'react-flexbox-grid';
|
6
|
+
import Heading from 'grommet/components/Heading';
|
7
|
+
import Box from 'grommet/components/Box';
|
8
|
+
import { Form, Field, FormState, nonBlank } from 'hippo/components/form';
|
9
|
+
|
10
|
+
import Notification from 'grommet/components/Notification';
|
11
|
+
import Extensions from '../../extensions';
|
12
|
+
import Layer from 'grommet/components/Layer';
|
13
|
+
import Paragraph from 'grommet/components/Paragraph';
|
14
|
+
import Anchor from 'grommet/components/Anchor';
|
15
|
+
import LinkIcon from 'grommet/components/icons/base/Link';
|
16
|
+
|
17
|
+
import Tenant from '../../models/tenant';
|
18
|
+
import Config from '../../config';
|
19
|
+
|
20
|
+
function onTenantSlugChangeClose() { }
|
21
|
+
|
22
|
+
function TenantSlugChange({ oldSlug }) {
|
23
|
+
if (!oldSlug) { return null; }
|
24
|
+
return (
|
25
|
+
<Layer onClose={onTenantSlugChangeClose}>
|
26
|
+
<Box pad="medium">
|
27
|
+
<Heading tag="h3">Your account identifier has changed!</Heading>
|
28
|
+
<Paragraph size='large'>
|
29
|
+
You will need to login to your account from the updated address at:
|
30
|
+
</Paragraph>
|
31
|
+
<Anchor icon={<LinkIcon />} label={Tenant.current.domain} href={`https://${Tenant.current.domain}`} primary={true} />
|
32
|
+
</Box>
|
33
|
+
</Layer>
|
34
|
+
);
|
35
|
+
}
|
36
|
+
|
37
|
+
@observer
|
38
|
+
export default class TenantConfig extends React.PureComponent {
|
39
|
+
|
40
|
+
formState = new FormState()
|
41
|
+
|
42
|
+
@observable slugChangedFrom;
|
43
|
+
|
44
|
+
onSave() {
|
45
|
+
const originalSlug = Tenant.current.slug;
|
46
|
+
this.formState
|
47
|
+
.persistTo(Tenant.current)
|
48
|
+
.then(() => Tenant.current.save())
|
49
|
+
.then(() => {
|
50
|
+
if (Tenant.current.slug !== originalSlug) {
|
51
|
+
this.slugChangedFrom = originalSlug;
|
52
|
+
}
|
53
|
+
});
|
54
|
+
}
|
55
|
+
|
56
|
+
componentWillMount() {
|
57
|
+
this.formState.setFromModel(Tenant.current);
|
58
|
+
}
|
59
|
+
|
60
|
+
renderIdChangeWarning() {
|
61
|
+
const slug = this.formState.get('slug.value');
|
62
|
+
if (!Tenant.current.slug || slug === Tenant.current.slug) {
|
63
|
+
return null;
|
64
|
+
}
|
65
|
+
return (
|
66
|
+
<Notification
|
67
|
+
size="small" status="warning"
|
68
|
+
message={`Warning: Changing the identifier will also change where you login at. The updated address will be: ${slug}.${Config.website_domain}`}
|
69
|
+
/>
|
70
|
+
);
|
71
|
+
}
|
72
|
+
|
73
|
+
render() {
|
74
|
+
return (
|
75
|
+
<Form tag="div" className="tenant-edit-form" state={this.formState}>
|
76
|
+
<TenantSlugChange oldSlug={this.slugChangedFrom} />
|
77
|
+
<Heading tag="h3">Account</Heading>
|
78
|
+
<Row>
|
79
|
+
<Field
|
80
|
+
md={4} xs={6} name="slug"
|
81
|
+
label="Identifier"
|
82
|
+
validate={nonBlank}
|
83
|
+
/>
|
84
|
+
<Field md={4} xs={6} name="name" validate={nonBlank} />
|
85
|
+
</Row>
|
86
|
+
{this.renderIdChangeWarning()}
|
87
|
+
</Form>
|
88
|
+
);
|
89
|
+
}
|
90
|
+
}
|
@@ -6,12 +6,13 @@ import { isNil, forIn, get, pick, mapValues, keys, extend } from 'lodash';
|
|
6
6
|
import { observer } from 'mobx-react';
|
7
7
|
import { action, observable, computed } from 'mobx';
|
8
8
|
|
9
|
-
import
|
9
|
+
import Box from 'grommet/components/Box';
|
10
|
+
import Button from 'grommet/components/Button';
|
10
11
|
import Warning from 'hippo/components/warning-notification';
|
11
12
|
|
12
13
|
import Query from 'hippo/models/query';
|
13
14
|
|
14
|
-
import { Form, Field,
|
15
|
+
import { Form, Field, FormState, nonBlank, validEmail, booleanValue, field } from 'hippo/components/form';
|
15
16
|
|
16
17
|
@observer
|
17
18
|
export default class EditForm extends React.PureComponent {
|
@@ -22,15 +23,9 @@ export default class EditForm extends React.PureComponent {
|
|
22
23
|
onComplete: PropTypes.func.isRequired,
|
23
24
|
}
|
24
25
|
|
25
|
-
static desiredHeight =
|
26
|
+
static desiredHeight = 300
|
26
27
|
|
27
|
-
|
28
|
-
is_admin: booleanValue,
|
29
|
-
login: nonBlank,
|
30
|
-
name: nonBlank,
|
31
|
-
email: validEmail,
|
32
|
-
password: field,
|
33
|
-
})
|
28
|
+
formState = new FormState();
|
34
29
|
|
35
30
|
constructor(props) {
|
36
31
|
super(props);
|
@@ -39,12 +34,12 @@ export default class EditForm extends React.PureComponent {
|
|
39
34
|
}
|
40
35
|
|
41
36
|
componentDidMount() {
|
42
|
-
this.
|
37
|
+
this.formState.setFromModel(this.user);
|
43
38
|
}
|
44
39
|
|
45
40
|
@action.bound
|
46
41
|
onSave() {
|
47
|
-
this.
|
42
|
+
this.formState.persistTo(this.user);
|
48
43
|
this.user.save().then(this.onSaved);
|
49
44
|
}
|
50
45
|
|
@@ -62,30 +57,25 @@ export default class EditForm extends React.PureComponent {
|
|
62
57
|
this.props.onComplete();
|
63
58
|
}
|
64
59
|
|
65
|
-
|
66
60
|
render() {
|
67
|
-
const { fields } = this;
|
68
|
-
|
69
61
|
return (
|
70
|
-
<Form tag="div" className="user-edit-form"
|
62
|
+
<Form tag="div" className="user-edit-form" state={this.formState}>
|
71
63
|
<Warning message={this.errorMessage} />
|
72
64
|
<Row middle='sm'>
|
73
|
-
<Field md={4} xs={6} name="login" />
|
74
|
-
<Field md={4} xs={6} name="name" />
|
75
|
-
<Field md={4} xs={6} name="email" />
|
65
|
+
<Field md={4} xs={6} name="login" validate={nonBlank} />
|
66
|
+
<Field md={4} xs={6} name="name" validate={nonBlank} />
|
67
|
+
<Field md={4} xs={6} name="email" validate={validEmail} />
|
76
68
|
<Field md={4} xs={6} type="password" name="password" />
|
77
|
-
<Field md={4} xs={6} type="checkbox" name="is_admin" />
|
78
|
-
</Row>
|
79
|
-
<Row>
|
69
|
+
<Field md={4} xs={6} type="checkbox" name="is_admin" validate={booleanValue} />
|
80
70
|
<Col md={4} xs={6}>
|
81
|
-
<
|
71
|
+
<Box justify="around" direction="row">
|
82
72
|
<Button label="Cancel" onClick={this.onCancel} accent />
|
83
73
|
<Button
|
84
74
|
label="Save"
|
85
|
-
onClick={
|
75
|
+
onClick={this.formState.isValid ? this.onSave : null}
|
86
76
|
primary
|
87
77
|
/>
|
88
|
-
</
|
78
|
+
</Box>
|
89
79
|
</Col>
|
90
80
|
</Row>
|
91
81
|
</Form>
|
@@ -35,27 +35,4 @@ pre {
|
|
35
35
|
&.is-active {
|
36
36
|
display: flex;
|
37
37
|
}
|
38
|
-
|
39
38
|
}
|
40
|
-
|
41
|
-
/* $workspace-header-height: 50px; */
|
42
|
-
|
43
|
-
/* @import "../styles/bootstrap"; */
|
44
|
-
/* @import "../styles/fonts"; */
|
45
|
-
/* @import "../styles/global"; */
|
46
|
-
|
47
|
-
/* // extensions are rooted at .hippo */
|
48
|
-
/* .hippo { */
|
49
|
-
/* padding: 0px; */
|
50
|
-
/* margin: 0px; */
|
51
|
-
/* background-color: $body-bg; */
|
52
|
-
/* position: relative; */
|
53
|
-
/* min-height: 10px; // needs height for resizing sensor to function */
|
54
|
-
/* } */
|
55
|
-
|
56
|
-
/* @import "styles/layout"; */
|
57
|
-
/* @import "styles/header"; */
|
58
|
-
/* @import "styles/tabs"; */
|
59
|
-
/* @import "styles/screens"; */
|
60
|
-
/* @import "styles/forms"; */
|
61
|
-
/* @import "styles/keybindings"; */
|
@@ -6,15 +6,17 @@
|
|
6
6
|
"transform-function-bind",
|
7
7
|
"transform-react-jsx",
|
8
8
|
"transform-runtime"
|
9
|
+
"lodash"
|
9
10
|
],
|
10
11
|
"presets": [
|
11
|
-
"es2015",
|
12
|
+
["es2015", {"modules": false}],
|
12
13
|
"react",
|
13
|
-
"stage-1"
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
"stage-1",
|
15
|
+
["env", {
|
16
|
+
"targets": {
|
17
|
+
"browsers": ["> 1%"]
|
18
|
+
},
|
19
|
+
"debug": true
|
20
|
+
}]
|
21
|
+
]
|
20
22
|
}
|
data/config/routes.rb
CHANGED
@@ -1,28 +1,59 @@
|
|
1
|
-
Hippo::API
|
1
|
+
module Hippo::API
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
routes.for_extension 'hippo' do
|
4
|
+
get 'job-statuses/:id.json' do
|
5
|
+
wrap_reply do
|
6
|
+
status = Hippo::Job.status_for_id(params[:id])
|
7
|
+
raise ActiveRecord::RecordNotFound unless status
|
8
|
+
std_api_reply :update, status, success: true
|
9
|
+
end
|
8
10
|
end
|
9
|
-
end
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
post "user-sessions.json", &Hippo::API::Handlers::UserSession.create
|
13
|
+
get "user-sessions/test.json", &Hippo::API::Handlers::UserSession.check
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
delete "user-sessions/:id.json" do
|
16
|
+
wrap_reply do
|
17
|
+
{ success: true, message: "Logout succeeded", data: {}, token: '' }
|
18
|
+
end
|
17
19
|
end
|
18
|
-
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
get 'bootstrap.json' do
|
22
|
+
wrap_reply do
|
23
|
+
{ success: true, data: Hippo::Extensions.client_bootstrap_data }
|
24
|
+
end
|
23
25
|
end
|
26
|
+
|
27
|
+
resources Hippo::User
|
28
|
+
resources Hippo::Tenant, controller: Hippo::API::Handlers::Tenant
|
29
|
+
end
|
30
|
+
|
31
|
+
routes.draw do
|
32
|
+
|
33
|
+
put Hippo.config.api_path + '/hippo/system-settings.json',
|
34
|
+
&Hippo::SystemSettings.update_handler
|
35
|
+
|
36
|
+
get Hippo.config.api_path + '/hippo/system-settings.json',
|
37
|
+
&Hippo::SystemSettings.get_handler
|
38
|
+
|
39
|
+
post Hippo.config.api_path + Hippo.config.assets_path_prefix,
|
40
|
+
&Hippo::API::Handlers::Asset.saver
|
41
|
+
|
42
|
+
get Hippo.config.api_path + Hippo.config.assets_path_prefix + '/*',
|
43
|
+
&Hippo::API::Handlers::Asset.file_getter
|
44
|
+
|
45
|
+
get Hippo.config.assets_path_prefix + '/:asset.js',
|
46
|
+
&Hippo::API::Handlers::Asset.asset_getter
|
47
|
+
|
48
|
+
get Hippo.config.api_path + Hippo.config.print_path_prefix + '/:template_id/:model_id.pdf',
|
49
|
+
&Hippo::API::Handlers::Print.getter
|
50
|
+
|
24
51
|
end
|
25
52
|
|
26
|
-
|
53
|
+
end
|
27
54
|
|
55
|
+
Hippo::API::Routing.root_view_route ||= lambda do
|
56
|
+
Hippo::API::Root.get '/*' do
|
57
|
+
erb :index
|
58
|
+
end
|
28
59
|
end
|
data/config/webpack.config.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2
1
|
const webpack = require('webpack');
|
3
2
|
const path = require('path');
|
4
3
|
|
@@ -10,12 +9,15 @@ const config = {
|
|
10
9
|
],
|
11
10
|
},
|
12
11
|
output: {
|
13
|
-
path:
|
14
|
-
publicPath: '/',
|
15
|
-
filename: '
|
12
|
+
path: '<%= config_directory.join('..','public', 'assets') %>',
|
13
|
+
publicPath: '<%= Hippo.env.production? ? '/assets/' : 'http://test.hippo.dev:8889/assets/' %>',
|
14
|
+
filename: '[name]-[hash].js',
|
16
15
|
},
|
17
16
|
resolve: {
|
18
|
-
modules: [
|
17
|
+
modules: [
|
18
|
+
"<%= Hippo::Extensions.client_module_paths.join('","') %>",
|
19
|
+
"<%= generated_directory.to_s %>",
|
20
|
+
],
|
19
21
|
extensions: ['.js', '.jsx'],
|
20
22
|
},
|
21
23
|
module: {
|
@@ -57,13 +59,6 @@ const config = {
|
|
57
59
|
},
|
58
60
|
devtool: 'source-map',
|
59
61
|
plugins: [
|
60
|
-
new webpack.optimize.CommonsChunkPlugin({
|
61
|
-
name: 'vendor', minChunks: Infinity, filename: '[name].[hash].js',
|
62
|
-
}),
|
63
|
-
new HtmlWebpackPlugin({
|
64
|
-
filename: 'index.html',
|
65
|
-
template: '<%= directory.join('index.html') %>',
|
66
|
-
}),
|
67
62
|
new webpack.DefinePlugin({
|
68
63
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
|
69
64
|
}),
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateTenants < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :tenants do |t|
|
4
|
+
t.string :slug, :email, null: false
|
5
|
+
t.text :identifier, :name, null: false
|
6
|
+
t.text :address, :phone_number
|
7
|
+
t.integer :subscription, limit: 1
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_index :tenants, :slug, :unique => true
|
11
|
+
add_index :tenants, :identifier, :unique => true
|
12
|
+
end
|
13
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class CreateSystemSettings < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
3
|
|
4
|
-
create_table "system_settings" do |t|
|
4
|
+
create_table "system_settings", partition_key: :tenant_id do |t|
|
5
|
+
t.integer :tenant_id, null: false
|
5
6
|
t.integer :configuration_id
|
6
7
|
t.jsonb "settings", null: false, default: {}
|
7
8
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
class CreateAssets < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
|
-
|
4
|
-
|
3
|
+
create_table "assets", partition_key: :tenant_id do |t|
|
4
|
+
t.integer :tenant_id, null: false
|
5
5
|
t.references :owner, polymorphic: true, null: false
|
6
6
|
t.integer :order
|
7
7
|
t.jsonb :file_data, null: false, default: {}
|
8
8
|
end
|
9
|
-
|
10
9
|
add_index :assets, [:owner_id, :owner_type]
|
11
|
-
|
12
10
|
end
|
13
11
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
class CreateUsers < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
|
-
create_table :users do | t |
|
3
|
+
create_table :users, partition_key: :tenant_id do | t |
|
4
|
+
t.integer :tenant_id, null: false
|
4
5
|
t.string :login, :name, :email, null: false
|
5
6
|
t.string :password_digest, null: false
|
6
7
|
t.string "role_names", array: true, null:false, default: []
|
7
8
|
t.jsonb "options", null: false, default: {}
|
8
9
|
t.timestamps null:false
|
9
10
|
end
|
10
|
-
|
11
|
+
|
12
|
+
add_index :users, [:login, :tenant_id], unique: true
|
11
13
|
end
|
12
14
|
end
|
data/db/seed.rb
CHANGED
@@ -1 +1,10 @@
|
|
1
|
-
Hippo::
|
1
|
+
system = Hippo::Tenant.system
|
2
|
+
system.perform do
|
3
|
+
Hippo::User.seed_admin_account
|
4
|
+
end
|
5
|
+
|
6
|
+
testing = Hippo::Tenant.find_or_create_by(slug: 'test', name: 'testing tenant', email: 'test@test.com')
|
7
|
+
|
8
|
+
testing.perform do
|
9
|
+
Hippo::User.seed_admin_account
|
10
|
+
end
|
data/hippo-fw.gemspec
CHANGED
@@ -24,56 +24,58 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.required_ruby_version = ">= 2.0"
|
26
26
|
|
27
|
-
spec.add_dependency "activejob",
|
28
|
-
spec.add_dependency "activerecord",
|
29
|
-
spec.add_dependency "actioncable",
|
30
|
-
spec.add_dependency "
|
31
|
-
spec.add_dependency "
|
32
|
-
spec.add_dependency
|
33
|
-
spec.add_dependency
|
34
|
-
spec.add_dependency '
|
35
|
-
spec.add_dependency '
|
36
|
-
spec.add_dependency '
|
37
|
-
spec.add_dependency
|
38
|
-
spec.add_dependency '
|
39
|
-
spec.add_dependency "
|
40
|
-
spec.add_dependency
|
41
|
-
spec.add_dependency "
|
42
|
-
|
43
|
-
spec.add_dependency "rack
|
44
|
-
|
45
|
-
|
46
|
-
spec.add_dependency "
|
47
|
-
|
48
|
-
spec.add_dependency "
|
49
|
-
|
50
|
-
spec.add_dependency "
|
51
|
-
|
52
|
-
spec.add_dependency "
|
53
|
-
|
54
|
-
spec.add_dependency "
|
55
|
-
|
56
|
-
spec.add_dependency "
|
57
|
-
|
58
|
-
spec.add_dependency "
|
59
|
-
|
60
|
-
spec.add_dependency "
|
61
|
-
|
62
|
-
spec.add_dependency "
|
63
|
-
|
64
|
-
spec.add_dependency "
|
65
|
-
|
66
|
-
spec.add_dependency "
|
67
|
-
spec.add_dependency "
|
68
|
-
spec.add_dependency "
|
69
|
-
spec.add_dependency "
|
70
|
-
spec.add_dependency "
|
71
|
-
spec.add_dependency "
|
72
|
-
|
73
|
-
spec.add_dependency "
|
74
|
-
|
75
|
-
spec.
|
76
|
-
|
77
|
-
spec.add_development_dependency "
|
27
|
+
spec.add_dependency "activejob", "~> 5.0.0"
|
28
|
+
spec.add_dependency "activerecord", "~> 5.0.0"
|
29
|
+
spec.add_dependency "actioncable", "~> 5.0.0"
|
30
|
+
# spec.add_dependency "activerecord-multi-tenant", "~> 0.5"
|
31
|
+
spec.add_dependency "mail", "~> 2.6"
|
32
|
+
spec.add_dependency "scenic", "~> 1.4"
|
33
|
+
spec.add_dependency "liquid", "~> 4.0"
|
34
|
+
spec.add_dependency 'erb_latex', "~> 1.0"
|
35
|
+
spec.add_dependency 'shrine-memory', "~> 0.2"
|
36
|
+
spec.add_dependency 'factory_girl', "~> 4.8"
|
37
|
+
spec.add_dependency 'faker', "~> 1.7"
|
38
|
+
spec.add_dependency 'webmock', "~> 3.0"
|
39
|
+
spec.add_dependency "database_cleaner", "~> 1.3"
|
40
|
+
spec.add_dependency 'vcr', "~> 3.0"
|
41
|
+
spec.add_dependency "sinatra", "~> 2.0.0"
|
42
|
+
spec.add_dependency "rack-protection", "~> 2.0.0"
|
43
|
+
spec.add_dependency "rack", "~> 2.0"
|
44
|
+
|
45
|
+
spec.add_dependency "rack-cors", "~> 0.4"
|
46
|
+
spec.add_dependency "rack-test", "~> 0.6"
|
47
|
+
|
48
|
+
spec.add_dependency "bcrypt", "~> 3.1"
|
49
|
+
spec.add_dependency "shrine", "~> 2.4"
|
50
|
+
spec.add_dependency "image_processing", "~> 0.4"
|
51
|
+
|
52
|
+
spec.add_dependency "execjs", "~> 2.6"
|
53
|
+
spec.add_dependency "fastimage", "~> 2.0"
|
54
|
+
spec.add_dependency "guard", "~> 2.13"
|
55
|
+
|
56
|
+
spec.add_dependency "rspec-rails", "~> 3.6"
|
57
|
+
|
58
|
+
spec.add_dependency "guard-jest", "~> 0.1"
|
59
|
+
spec.add_dependency "guard-rspec", "~> 4.7"
|
60
|
+
spec.add_dependency "hashie", "~> 3.3"
|
61
|
+
|
62
|
+
spec.add_dependency "jobba", "~> 1.4"
|
63
|
+
spec.add_dependency "jwt", "~> 1.5"
|
64
|
+
spec.add_dependency "mini_magick", "~> 4.3"
|
65
|
+
|
66
|
+
spec.add_dependency "oj", "~> 2.1"
|
67
|
+
spec.add_dependency "pg", "~> 0.8"
|
68
|
+
spec.add_dependency "rake", "~> 12.0"
|
69
|
+
spec.add_dependency "require_all", "~> 1.3"
|
70
|
+
spec.add_dependency "resque", "~> 1.27"
|
71
|
+
spec.add_dependency "sanitize", "~> 3.0"
|
72
|
+
spec.add_dependency "webpack_driver", "~> 0.3.7"
|
73
|
+
spec.add_dependency "knitter", "~> 0.2.2"
|
74
|
+
|
75
|
+
spec.add_dependency "thor", "~> 0.19"
|
76
|
+
|
77
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
78
|
+
spec.add_development_dependency "diffy", "~> 3.0"
|
79
|
+
spec.add_development_dependency "growl", "~> 1.0"
|
78
80
|
spec.add_development_dependency "shrine-memory", "~> 0.2"
|
79
81
|
end
|