Skip to content

Commit

Permalink
Merge pull request #6 from Harry3167/feat/add-program-space-apis
Browse files Browse the repository at this point in the history
fix: remove data schema from lib
  • Loading branch information
Harry3167 authored Apr 14, 2023
2 parents 8533f7b + eb510a4 commit abcfac9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 80 deletions.
4 changes: 2 additions & 2 deletions CompassRNSampleApp/src/screens/ProgramSpaceDataDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { View, Text, StyleSheet, Dimensions, ScrollView } from 'react-native';
import CustomButton from './components/CustomButton';
import { buttonLabels, screens } from '../assets/strings';
import { themeColors } from '../assets/colors';
import type { ProgramSpaceResponse } from '../types/programSpaceDataType';
import type { SharedSpaceDataSchema } from '../types/programSpaceDataType';

const { width: WIDTH } = Dimensions.get('screen');

const ProgramSpaceDataDetails = ({ route, navigation }: any) => {
const { programSpaceData } = route?.params;
const [data, setData] = useState<ProgramSpaceResponse>();
const [data, setData] = useState<SharedSpaceDataSchema>();

const updateStateWithData = useCallback(() => {
setData(JSON.parse(programSpaceData));
Expand Down
2 changes: 1 addition & 1 deletion CompassRNSampleApp/src/screens/WriteProgramSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
getRegistrationData,
WriteProgramSpaceResultType,
RegistrationDataResultType,
SharedSpaceDataSchema,
} from 'community-pass-react-native-wrapper';
import { PROGRAM_GUID, RELIANT_APP_GUID } from '@env';

Expand All @@ -18,6 +17,7 @@ import {
} from '../assets/strings';
import { themeColors } from '../assets/colors';
import data from '../../data/sharedSpaceData.json';
import type { SharedSpaceDataSchema } from '../types/programSpaceDataType';

const { width: WIDTH } = Dimensions.get('screen');
const sharedSpaceData: SharedSpaceDataSchema = data;
Expand Down
44 changes: 6 additions & 38 deletions CompassRNSampleApp/src/types/programSpaceDataType.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
export interface ProgramSpaceRequest {
export interface SharedSpaceDataSchema {
collectionInfo: CollectionInfo;
user: User;
version: number;
}

export interface ProgramSpaceResponse {
collectionInfo: ResponseCollectionInfo;
user: ResponseUser;
}

interface CollectionInfo {
collections: Collection[];
fifthCollection: Collection;
firstCollection: Collection;
fourthCollection: Collection;
lastAmountPaidOut: number;
lastPayoutTimeStamp: number;
noOfPaidCollections: number;
secondCollection: Collection;
thirdCollection: Collection;
totalAmountPaid: number;
}

Expand All @@ -28,36 +26,6 @@ interface Collection {
}

interface User {
address: string;
age: number;
firstName: string;
id: string;
lastName: string;
}

interface ResponseCollectionInfo {
fifthCollection: ResponseCollection;
firstCollection: ResponseCollection;
fourthCollection: ResponseCollection;
lastAmountPaidOut: number;
lastPayoutTimeStamp: number;
noOfPaidCollections: number;
secondCollection: ResponseCollection;
thirdCollection: ResponseCollection;
totalAmountPaid: number;
}

interface ResponseCollection {
amount: number;
amountPerGram: number;
id: string;
produceId: string;
produceName: string;
timeStamp: number;
weightInGrams: number;
}

interface ResponseUser {
address: string;
age: number;
consentId: string;
Expand Down
39 changes: 0 additions & 39 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,42 +237,3 @@ export interface ReadProgramSpaceResultType {
export interface WriteProgramSpaceResultType {
isSuccess: boolean;
}

export interface SharedSpaceDataSchema {
collectionInfo: CollectionInfo;
user: User;
}

interface CollectionInfo {
fifthCollection: Collection;
firstCollection: Collection;
fourthCollection: Collection;
lastAmountPaidOut: number;
lastPayoutTimeStamp: number;
noOfPaidCollections: number;
secondCollection: Collection;
thirdCollection: Collection;
totalAmountPaid: number;
}

interface Collection {
amount: number;
amountPerGram: number;
id: string;
produceId: string;
produceName: string;
timeStamp: number;
weightInGrams: number;
}

interface User {
address: string;
age: number;
consentId: string;
consumerDeviceId: string;
firstName: string;
identifier: string;
lastName: string;
mobileNumber: string;
rId: string;
}

0 comments on commit abcfac9

Please sign in to comment.