Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QSI_Groupe4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lydia Tarmelit
QSI_Groupe4
Commits
c2e17a26
Commit
c2e17a26
authored
1 year ago
by
Nawfel Senoussi
Browse files
Options
Downloads
Patches
Plain Diff
remove is admin of association
parent
1ecd665f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/handlers/association/associationHandlers.ts
+2
-16
2 additions, 16 deletions
src/handlers/association/associationHandlers.ts
src/services/association.service.ts
+1
-12
1 addition, 12 deletions
src/services/association.service.ts
src/utils/getRole.ts
+0
-6
0 additions, 6 deletions
src/utils/getRole.ts
with
3 additions
and
34 deletions
src/handlers/association/associationHandlers.ts
+
2
−
16
View file @
c2e17a26
...
...
@@ -5,7 +5,7 @@ import { type TezosToolkit } from '@taquito/taquito'
import
{
type
Association
}
from
'
../../types/Association.js
'
// IMPORT SERVICES
import
{
createAssociation
,
getAssociationDetails
,
getAssociations
,
isAdminOfAssociation
,
joinAssociation
}
from
'
../../services/association.service.js
'
import
{
createAssociation
,
getAssociationDetails
,
getAssociations
,
joinAssociation
}
from
'
../../services/association.service.js
'
import
inquirer
from
'
inquirer
'
/**
...
...
@@ -136,18 +136,4 @@ async function handleGetAssociationDetails (associations: string[], tezos: Tezos
}
}
/**
* Handles the process of is admin.
* @param {TezosToolkit} tezos - The TezosToolkit instance used for blockchain operations.
* @returns {Promise<boolean>} A promise with a boolean of is admin.
*/
async
function
handleIsAdmin
(
tezos
:
TezosToolkit
):
Promise
<
boolean
>
{
try
{
return
await
isAdminOfAssociation
(
tezos
)
}
catch
(
error
)
{
const
errorMessage
=
error
.
message
?
error
.
message
:
'
Unknown error occurred
'
throw
new
Error
(
`
${
errorMessage
}
`
)
}
}
export
{
handleCreateAssociation
,
handleJoinAssociation
,
handleGetAssociations
,
handleGetAssociationDetails
,
handleIsAdmin
}
export
{
handleCreateAssociation
,
handleJoinAssociation
,
handleGetAssociations
,
handleGetAssociationDetails
}
This diff is collapsed.
Click to expand it.
src/services/association.service.ts
+
1
−
12
View file @
c2e17a26
...
...
@@ -49,15 +49,4 @@ async function getAssociationDetails (associationName: string, tezos: TezosToolk
return
associationDetails
}
async
function
isAdminOfAssociation
(
tezos
:
TezosToolkit
):
Promise
<
boolean
>
{
const
contract
=
await
tezos
.
contract
.
at
(
address
)
const
executionContextParams
=
{
viewCaller
:
contract
.
address
}
const
isAdmin
:
boolean
=
await
contract
.
contractViews
.
isAdmin
(
'
Test
'
).
executeView
(
executionContextParams
)
return
isAdmin
}
export
{
createAssociation
,
joinAssociation
,
getAssociations
,
getAssociationDetails
,
isAdminOfAssociation
}
export
{
createAssociation
,
joinAssociation
,
getAssociations
,
getAssociationDetails
}
This diff is collapsed.
Click to expand it.
src/utils/getRole.ts
+
0
−
6
View file @
c2e17a26
import
{
type
TezosToolkit
}
from
'
@taquito/taquito
'
import
{
type
Role
}
from
'
../types/Role
'
import
{
handleIsAdmin
}
from
'
../handlers/association/associationHandlers.js
'
export
async
function
getRole
(
tezos
:
TezosToolkit
):
Promise
<
Role
>
{
// const isAdmin = await handleIsAdmin(tezos)
// if (isAdmin) return 'ADMIN'
// TEMPORARY
return
'
CONNECTED
'
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment