Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
angular-meteor
api
Commits
6fd1e96b
Commit
6fd1e96b
authored
Dec 14, 2019
by
GD-A-150752
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code-refactor-naming
parent
fe514a05
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
16 additions
and
16 deletions
+16
-16
app.seeding.ts
server/app.seeding.ts
+1
-1
role.collection.ts
server/collections/role.collection.ts
+2
-2
roles.method.ts
server/methods/roles.method.ts
+3
-3
users.method.ts
server/methods/users.method.ts
+3
-3
query.model.ts
server/models/query.model.ts
+1
-1
role.model.ts
server/models/role.model.ts
+1
-1
roles.publication.ts
server/publications/roles.publication.ts
+1
-1
users.publication.ts
server/publications/users.publication.ts
+3
-3
utils.service.ts
server/services/utils.service.ts
+1
-1
No files found.
server/app.seeding.ts
View file @
6fd1e96b
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Roles
}
from
'./collections/role'
;
import
{
Roles
}
from
'./collections/role
.collection
'
;
import
{
PERMISSIONS
}
from
'./config'
;
import
{
PERMISSIONS
}
from
'./config'
;
export
const
seedDB
=
async
()
=>
{
export
const
seedDB
=
async
()
=>
{
...
...
server/collections/role.ts
→
server/collections/role.
collection.
ts
View file @
6fd1e96b
import
{
MongoObservable
}
from
'meteor-rxjs'
;
import
{
MongoObservable
}
from
'meteor-rxjs'
;
import
{
Role
}
from
'../models/role
'
;
import
{
Role
Model
}
from
'../models/role.model
'
;
// tslint:disable-next-line:variable-name
// tslint:disable-next-line:variable-name
export
const
Roles
=
new
MongoObservable
.
Collection
<
Role
>
(
'roles'
);
export
const
Roles
=
new
MongoObservable
.
Collection
<
Role
Model
>
(
'roles'
);
server/methods/roles.ts
→
server/methods/roles.
method.
ts
View file @
6fd1e96b
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
first
}
from
'rxjs/operators'
;
import
{
first
}
from
'rxjs/operators'
;
import
{
Roles
}
from
'../collections/role'
;
import
{
Roles
}
from
'../collections/role
.collection
'
;
import
{
PERMISSIONS
}
from
'../config'
;
import
{
PERMISSIONS
}
from
'../config'
;
import
{
Role
}
from
'../models/role
'
;
import
{
Role
Model
}
from
'../models/role.model
'
;
import
{
UtilsService
}
from
'../services/utils.service'
;
import
{
UtilsService
}
from
'../services/utils.service'
;
Meteor
.
methods
({
Meteor
.
methods
({
async
saveRole
(
role
:
Role
):
Promise
<
void
>
{
async
saveRole
(
role
:
Role
Model
):
Promise
<
void
>
{
try
{
try
{
if
(
role
.
_id
&&
UtilsService
.
hasPermission
(
PERMISSIONS
.
UPDATE_ROLE
))
{
if
(
role
.
_id
&&
UtilsService
.
hasPermission
(
PERMISSIONS
.
UPDATE_ROLE
))
{
await
Roles
.
update
(
role
.
_id
,
role
)
await
Roles
.
update
(
role
.
_id
,
role
)
...
...
server/methods/users.ts
→
server/methods/users.
method.
ts
View file @
6fd1e96b
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Roles
}
from
'../collections/role'
;
import
{
Roles
}
from
'../collections/role
.collection
'
;
import
{
PERMISSIONS
}
from
'../config'
;
import
{
PERMISSIONS
}
from
'../config'
;
import
{
UtilsService
}
from
'../services/utils.service'
;
import
{
UtilsService
}
from
'../services/utils.service'
;
import
{
Query
}
from
'../models/query
'
;
import
{
Query
Model
}
from
'../models/query.model
'
;
Meteor
.
methods
({
Meteor
.
methods
({
usersGetCount
(
query
:
Query
):
any
{
usersGetCount
(
query
:
Query
Model
):
any
{
return
{
return
{
recordsFiltered
:
Meteor
.
users
.
find
(
query
.
query
).
count
(),
recordsFiltered
:
Meteor
.
users
.
find
(
query
.
query
).
count
(),
recordsTotal
:
Meteor
.
users
.
find
().
count
(),
recordsTotal
:
Meteor
.
users
.
find
().
count
(),
...
...
server/models/query.ts
→
server/models/query.
model.
ts
View file @
6fd1e96b
export
class
Query
{
export
class
Query
Model
{
constructor
(
constructor
(
public
query
=
{}
as
any
,
public
query
=
{}
as
any
,
...
...
server/models/role.ts
→
server/models/role.
model.
ts
View file @
6fd1e96b
export
interface
Role
{
export
interface
Role
Model
{
_id
?:
string
;
_id
?:
string
;
title
:
string
;
title
:
string
;
permissions
:
string
[];
permissions
:
string
[];
...
...
server/publications/roles.ts
→
server/publications/roles.
publication.
ts
View file @
6fd1e96b
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Roles
}
from
'../collections/role'
;
import
{
Roles
}
from
'../collections/role
.collection
'
;
Meteor
.
publish
(
'roles'
,
()
=>
Roles
.
find
({}));
Meteor
.
publish
(
'roles'
,
()
=>
Roles
.
find
({}));
server/publications/users.ts
→
server/publications/users.
publication.
ts
View file @
6fd1e96b
...
@@ -3,13 +3,13 @@ import { Meteor } from 'meteor/meteor';
...
@@ -3,13 +3,13 @@ import { Meteor } from 'meteor/meteor';
// @ts-ignore
// @ts-ignore
import
{
publishComposite
}
from
'meteor/reywood:publish-composite'
;
import
{
publishComposite
}
from
'meteor/reywood:publish-composite'
;
import
{
PERMISSIONS
}
from
'../config'
;
import
{
PERMISSIONS
}
from
'../config'
;
import
{
Query
}
from
'../models/query
'
;
import
{
Query
Model
}
from
'../models/query.model
'
;
import
{
UtilsService
}
from
'../services/utils.service'
;
import
{
UtilsService
}
from
'../services/utils.service'
;
import
{
Roles
}
from
'../collections/role'
;
import
{
Roles
}
from
'../collections/role
.collection
'
;
publishComposite
(
'usersList'
,
(
filters
=
{})
=>
{
publishComposite
(
'usersList'
,
(
filters
=
{})
=>
{
const
queryFilters
=
{
...
new
Query
(),
...
filters
};
const
queryFilters
=
{
...
new
Query
Model
(),
...
filters
};
if
(
!
UtilsService
.
hasPermission
([
PERMISSIONS
.
CAN_SEE_ALL_USERS
]))
{
if
(
!
UtilsService
.
hasPermission
([
PERMISSIONS
.
CAN_SEE_ALL_USERS
]))
{
throw
new
Meteor
.
Error
(
403
,
'Not enough permissions to get all users'
);
throw
new
Meteor
.
Error
(
403
,
'Not enough permissions to get all users'
);
...
...
server/services/utils.service.ts
View file @
6fd1e96b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
AWS
=
require
(
'aws-sdk'
);
import
AWS
=
require
(
'aws-sdk'
);
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Meteor
}
from
'meteor/meteor'
;
import
{
Observable
,
Subject
}
from
'rxjs'
;
import
{
Observable
,
Subject
}
from
'rxjs'
;
import
{
Roles
}
from
'../collections/role'
;
import
{
Roles
}
from
'../collections/role
.collection
'
;
export
class
UtilsService
{
export
class
UtilsService
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment