Bulk-commit
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 1m25s

This commit is contained in:
2024-10-26 08:43:37 +02:00
parent af0e2919f4
commit 9d72e3443b
62 changed files with 150794 additions and 1290 deletions

View File

@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the `UserExample` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "UserExample";
PRAGMA foreign_keys=on;

View File

@ -14,15 +14,6 @@ generator client {
binaryTargets = "native"
}
// Define your own datamodels here and run `yarn redwood prisma migrate dev`
// to create migrations for them and apply to your dev DB.
// TODO: Please remove the following example:
model UserExample {
id Int @id @default(autoincrement())
email String @unique
name String?
}
model User {
id Int @id @default(autoincrement())
email String @unique

View File

@ -3,10 +3,10 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@redwoodjs/api": "8.3.0",
"@redwoodjs/api-server": "8.3.0",
"@redwoodjs/auth-dbauth-api": "8.3.0",
"@redwoodjs/graphql-server": "8.3.0",
"@redwoodjs/api": "8.4.0",
"@redwoodjs/api-server": "8.4.0",
"@redwoodjs/auth-dbauth-api": "8.4.0",
"@redwoodjs/graphql-server": "8.4.0",
"crypto-js": "^4.2.0"
},
"devDependencies": {

View File

@ -4,6 +4,7 @@ export const schema = gql`
subject: String!
currentClass: String!
cost: Float!
userId: Int!
user: User!
}
@ -16,12 +17,14 @@ export const schema = gql`
subject: String!
currentClass: String!
cost: Float!
userId: Int!
}
input UpdateNachhilfeangebotInput {
subject: String
currentClass: String
cost: Float
userId: Int
}
type Mutation {

View File

@ -7,14 +7,26 @@ export const standard = defineScenario<Prisma.NachhilfeangebotCreateArgs>({
data: {
subject: 'String',
currentClass: 'String',
cost: 9626711.68060984,
cost: 3141165.177524339,
user: {
create: {
email: 'String393837',
updatedAt: '2024-10-25T18:31:22.454Z',
},
},
},
},
two: {
data: {
subject: 'String',
currentClass: 'String',
cost: 3400746.9395209556,
cost: 7812680.539293259,
user: {
create: {
email: 'String8800647',
updatedAt: '2024-10-25T18:31:22.454Z',
},
},
},
},
},

View File

@ -38,18 +38,20 @@ describe('nachhilfeangebots', () => {
}
)
scenario('creates a nachhilfeangebot', async () => {
scenario('creates a nachhilfeangebot', async (scenario: StandardScenario) => {
const result = await createNachhilfeangebot({
input: {
subject: 'String',
currentClass: 'String',
cost: 3443924.824820386,
cost: 5231481.901387487,
userId: scenario.nachhilfeangebot.two.userId,
},
})
expect(result.subject).toEqual('String')
expect(result.currentClass).toEqual('String')
expect(result.cost).toEqual(new Prisma.Decimal(3443924.824820386))
expect(result.cost).toEqual(new Prisma.Decimal(5231481.901387487))
expect(result.userId).toEqual(scenario.nachhilfeangebot.two.userId)
})
scenario('updates a nachhilfeangebot', async (scenario: StandardScenario) => {

View File

@ -1,4 +1,8 @@
import type { QueryResolvers, MutationResolvers } from 'types/graphql'
import type {
QueryResolvers,
MutationResolvers,
NachhilfeangebotRelationResolvers,
} from 'types/graphql'
import { db } from 'src/lib/db'
@ -9,21 +13,15 @@ export const nachhilfeangebots: QueryResolvers['nachhilfeangebots'] = () => {
export const nachhilfeangebot: QueryResolvers['nachhilfeangebot'] = ({
id,
}) => {
return {
...db.nachhilfeangebot.findUnique({
where: { id },
}),
user: db.nachhilfeangebot.findUnique({ where: { id } }).user(),
}
return db.nachhilfeangebot.findUnique({
where: { id },
})
}
export const createNachhilfeangebot: MutationResolvers['createNachhilfeangebot'] =
({ input }) => {
return db.nachhilfeangebot.create({
data: {
...input,
userId: context.currentUser.id,
},
data: input,
})
}
@ -41,3 +39,9 @@ export const deleteNachhilfeangebot: MutationResolvers['deleteNachhilfeangebot']
where: { id },
})
}
export const Nachhilfeangebot: NachhilfeangebotRelationResolvers = {
user: (_obj, { root }) => {
return db.nachhilfeangebot.findUnique({ where: { id: root?.id } }).user()
},
}