Files
hoppscotch/packages/hoppscotch-backend/src/user-collection/user-collections.model.ts
Balu Babu 18864bfecf feat: addition of data field into User and Team Collections (#3614)
* feat: added new columns into the TeamCollections and UserCollections models

* feat: completed addition of new data field in TeamCollection

* feat: completed addition of new data field in UserCollections

* chore: updated all tests in team-collection module

* chore: added tests for updateTeamCollection method in team-collection module

* chore: refactored all existing testcases in user-collection to reflect new changes

* chore: added new testcases for updateUserCollection method in user-collection module

* chore: made data field optional in team and user collections

* chore: fixed edgecases for data being null

* chore: resolved issue with team-request testcases

* chore: completed changes requested in PR review

* chore: changed target to prod in hoppscotch-old-backend service
2023-12-05 20:12:37 +05:30

76 lines
1.5 KiB
TypeScript

import { ObjectType, Field, ID, registerEnumType } from '@nestjs/graphql';
import { ReqType } from 'src/types/RequestTypes';
@ObjectType()
export class UserCollection {
@Field(() => ID, {
description: 'ID of the user collection',
})
id: string;
@Field({
description: 'Displayed title of the user collection',
})
title: string;
@Field({
description: 'JSON string representing the collection data',
nullable: true,
})
data: string;
@Field(() => ReqType, {
description: 'Type of the user collection',
})
type: ReqType;
parentID: string | null;
userID: string;
}
@ObjectType()
export class UserCollectionReorderData {
@Field({
description: 'User Collection being moved',
})
userCollection: UserCollection;
@Field({
description:
'User Collection succeeding the collection being moved in its new position',
nullable: true,
})
nextUserCollection?: UserCollection;
}
@ObjectType()
export class UserCollectionRemovedData {
@Field(() => ID, {
description: 'ID of User Collection being removed',
})
id: string;
@Field(() => ReqType, {
description: 'Type of the user collection',
})
type: ReqType;
}
registerEnumType(ReqType, {
name: 'CollType',
});
@ObjectType()
export class UserCollectionExportJSONData {
@Field(() => ID, {
description: 'Stringified contents of the collection',
})
exportedCollection: string;
@Field(() => ReqType, {
description: 'Type of the user collection',
})
collectionType: ReqType;
}