mirror of
https://github.com/aljazceru/landscape-template.git
synced 2025-12-18 06:44:22 +01:00
feat: wired linking account api and form state, updated card ui
This commit is contained in:
@@ -339,7 +339,7 @@ export interface NexusGenFieldTypes {
|
||||
deleteStory: NexusGenRootTypes['Story'] | null; // Story
|
||||
donate: NexusGenRootTypes['Donation']; // Donation!
|
||||
updateProfileDetails: NexusGenRootTypes['MyProfile'] | null; // MyProfile
|
||||
updateUserPreferences: NexusGenRootTypes['MyProfile'][]; // [MyProfile!]!
|
||||
updateUserPreferences: NexusGenRootTypes['MyProfile']; // MyProfile!
|
||||
vote: NexusGenRootTypes['Vote']; // Vote!
|
||||
}
|
||||
MyProfile: { // field return type
|
||||
|
||||
@@ -118,7 +118,7 @@ type Mutation {
|
||||
deleteStory(id: Int!): Story
|
||||
donate(amount_in_sat: Int!): Donation!
|
||||
updateProfileDetails(data: ProfileDetailsInput): MyProfile
|
||||
updateUserPreferences(userKeys: [UserKeyInputType!]): [MyProfile!]!
|
||||
updateUserPreferences(userKeys: [UserKeyInputType!]): MyProfile!
|
||||
vote(amount_in_sat: Int!, item_id: Int!, item_type: VOTE_ITEM_TYPE!): Vote!
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ const UserKeyInputType = inputObjectType({
|
||||
const updateUserPreferences = extendType({
|
||||
type: 'Mutation',
|
||||
definition(t) {
|
||||
t.nonNull.list.nonNull.field('updateUserPreferences', {
|
||||
t.nonNull.field('updateUserPreferences', {
|
||||
type: 'MyProfile',
|
||||
args: { userKeys: list(nonNull(UserKeyInputType)) },
|
||||
async resolve(_root, args, ctx) {
|
||||
@@ -182,7 +182,7 @@ const updateUserPreferences = extendType({
|
||||
equals: user.id,
|
||||
},
|
||||
key: {
|
||||
in: args.data.map(i => i.key)
|
||||
in: args.userKeys.map(i => i.key)
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -192,15 +192,15 @@ const updateUserPreferences = extendType({
|
||||
})).map(i => i.key);
|
||||
|
||||
const newKeys = [];
|
||||
for (let i = 0; i < args.data.length; i++) {
|
||||
const item = args.data[i];
|
||||
for (let i = 0; i < args.userKeys.length; i++) {
|
||||
const item = args.userKeys[i];
|
||||
if (userKeys.includes(item.key))
|
||||
newKeys.push(item);
|
||||
}
|
||||
|
||||
|
||||
if (newKeys.length === 0)
|
||||
throw new Error("You can't delete all your keys")
|
||||
throw new Error("You can't delete all your wallets keys")
|
||||
|
||||
await prisma.userKey.deleteMany({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user