Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Fix: add missing account creation date #319

Merged
merged 4 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion catalog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nevermined-io/catalog",
"version": "1.12.0",
"version": "1.12.1",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
Expand Down
12 changes: 2 additions & 10 deletions catalog/src/catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
try {
const query = await sdk.search.subscriptionsCreated(
account,
searchOptions?.customNestedQueries,
searchOptions?.offset,
searchOptions?.page,
searchOptions?.sort,
Expand All @@ -254,7 +253,6 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
try {
const query = await sdk.search.subscriptionsCreated(
account,
searchOptionsSubscriptions?.customNestedQueries,
searchOptionsSubscriptions?.offset,
searchOptionsSubscriptions?.page,
searchOptionsSubscriptions?.sort,
Expand All @@ -275,7 +273,6 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
try {
const query = await sdk.search.subscriptionsCreated(
account,
searchOptionsSubscriptions?.customNestedQueries,
searchOptionsSubscriptions?.offset,
searchOptionsSubscriptions?.page,
searchOptionsSubscriptions?.sort,
Expand All @@ -295,7 +292,6 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
try {
const query = await sdk.search.subscriptionsPurchased(
account,
searchOptions?.customNestedQueries,
searchOptions?.offset,
searchOptions?.page,
searchOptions?.sort,
Expand All @@ -316,7 +312,6 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
try {
const query = await sdk.search.subscriptionsPurchased(
account,
searchOptionsSubscriptions?.customNestedQueries,
searchOptionsSubscriptions?.offset,
searchOptionsSubscriptions?.page,
searchOptionsSubscriptions?.sort,
Expand All @@ -337,7 +332,6 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
try {
const query = await sdk.search.subscriptionsPurchased(
account,
searchOptionsSubscriptions?.customNestedQueries,
searchOptionsSubscriptions?.offset,
searchOptionsSubscriptions?.page,
searchOptionsSubscriptions?.sort,
Expand All @@ -357,7 +351,6 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
try {
const query = await sdk.search.servicesBySubscription(
did,
searchOptions?.customNestedQueries,
searchOptions?.offset,
searchOptions?.page,
searchOptions?.sort,
Expand All @@ -377,7 +370,6 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
try {
const query = await sdk.search.datasetsBySubscription(
did,
searchOptions?.customNestedQueries,
searchOptions?.offset,
searchOptions?.page,
searchOptions?.sort,
Expand Down Expand Up @@ -793,8 +785,8 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv

transferResult =
ercType === 721
? await sdk.nfts721.claim(agreementId, nftHolder, buyer.getId(), did)
: await sdk.nfts1155.claim(agreementId, nftHolder, buyer.getId(), nftAmount, did)
? await sdk.nfts721.claim(agreementId, nftHolder, buyer.getId())
: await sdk.nfts1155.claim(agreementId, nftHolder, buyer.getId(), nftAmount,)

if (!transferResult) {
throw new Error(
Expand Down
1 change: 1 addition & 0 deletions catalog/src/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ export const useUserProfile = (
nickname: userProfileData.nickname,
name: userProfileData.name,
email: userProfileData.email,
creationDate: userProfileData.creationDate,
updateDate: new Date(userProfileData.updateDate),
state: userProfileData.state,
additionalInformation: userProfileData.additionalInformation,
Expand Down
2 changes: 1 addition & 1 deletion catalog/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export interface UserProfileParams {
/** The email of the user */
email: string
/** When the user was created */
creationDate: string
creationDate: Date
/** When was the last user profile updated*/
updateDate: Date
/** Additional information of the user like picture, profesional profire, etc... */
Expand Down
2 changes: 0 additions & 2 deletions catalog/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export const getSubscriptionsAndServices = async (
subscriptionsDDOs.map(async (ddo) => {
const query = await sdk.search.servicesBySubscription(
ddo.id,
searchOptions?.customNestedQueries,
searchOptions?.offset,
searchOptions?.page,
searchOptions?.sort,
Expand All @@ -201,7 +200,6 @@ export const getSubscriptionsAndDatasets = async (
subscriptionsDDOs.map(async (ddo) => {
const query = await sdk.search.datasetsBySubscription(
ddo.id,
searchOptions?.customNestedQueries,
searchOptions?.offset,
searchOptions?.page,
searchOptions?.sort,
Expand Down
3 changes: 1 addition & 2 deletions catalog/src/utils/marketplace_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export const newMarketplaceApiToken = async ({

try {
const account = sdk.accounts.getAccount(address)

const credential = await sdk.utils.jwt.generateClientAssertion(account, message)
const credential = await sdk.utils.jwt.generateClientAssertion(account)
const token = await sdk.services.marketplace.login(credential)

const tokenKey = `${address}_${chainId}_${MARKETPLACE_API_TOKEN}`
Expand Down
15 changes: 11 additions & 4 deletions catalog/unit-tests/mockups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,28 +915,35 @@ export const newProfile: Partial<Profile> = {
nickname: faker.internet.userName(),
email: faker.internet.email(),
state: 'confirmed' as State,
creationDate: new Date(),
updateDate: new Date(),
addresses: [walletAddress],
additionalInformation: {
linkedinProfile: '',
biography: '',
interests: [],
},
}

export const updatedProfile: Partial<Profile> = {
...newProfile,
nickname: faker.internet.userName(),
additionalInformation: {
...(newProfile.additionalInformation as object),
biography: 'Bio',
interests: ['ai'],
},
}

export const profileResult = {
export const newProfileResult = {
userId: newProfile.userId,
name: newProfile.name,
nickname: newProfile.nickname,
email: newProfile.email,
creationDate: newProfile.creationDate,
updateDate: new Date(newProfile.updateDate || ''),
state: newProfile.state,
additionalInformation: {
linkedinProfile: '',
},
additionalInformation: newProfile.additionalInformation,
}

export const nevermined = {
Expand Down
4 changes: 2 additions & 2 deletions catalog/unit-tests/services/services.account.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ddo,
walletAddress,
walletAddress2,
profileResult,
newProfileResult,
nevermined,
newProfile,
updatedProfile,
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('Account Service', () => {
)

await waitFor(() => {
expect(result.current).toStrictEqual(profileResult)
expect(result.current).toStrictEqual(newProfileResult)
})
})

Expand Down
2 changes: 1 addition & 1 deletion providers/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nevermined-io/providers",
"private": false,
"version": "1.12.0",
"version": "1.12.1",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
Expand Down