Migrations!
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "createdAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updatedAt" TIMESTAMP(3);
|
||||
@@ -11,8 +11,10 @@ datasource db {
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
password String?
|
||||
time_joined Int?
|
||||
createdAt DateTime? @default(now())
|
||||
updatedAt DateTime? @updatedAt
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ export class User {
|
||||
email: string;
|
||||
password?: Nullable<string>;
|
||||
time_joined?: Nullable<number>;
|
||||
createdAt?: Nullable<DateTime>;
|
||||
updatedAt?: Nullable<DateTime>;
|
||||
}
|
||||
|
||||
export abstract class IQuery {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { PrismaService } from 'prisma/prisma.service';
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.enableCors({
|
||||
origin: [process.env.WEBAPP_URL],
|
||||
origin: [process.env.WEBAPP_URL, 'https://studio.apollographql.com'],
|
||||
allowedHeaders: ['content-type', ...supertokens.getAllCORSHeaders()],
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
@@ -5,6 +5,8 @@ type User {
|
||||
email: String!
|
||||
password: String
|
||||
time_joined: Int,
|
||||
createdAt: DateTime
|
||||
updatedAt: DateTime
|
||||
}
|
||||
|
||||
input CreateUserInput {
|
||||
|
||||
@@ -11,7 +11,7 @@ export class UsersResolver {
|
||||
return this.usersService.create(createUserInput);
|
||||
}
|
||||
@Query('users')
|
||||
findAll(@Args('params') params: Prisma.UserFindManyArgs) {
|
||||
findAll(@Args('params') params?: Prisma.UserFindManyArgs) {
|
||||
return this.usersService.users(params);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export class UsersService {
|
||||
return await this.prismaService.user.findUnique({ where: uniqueInput });
|
||||
}
|
||||
|
||||
async users(params: Prisma.UserFindManyArgs) {
|
||||
async users(params?: Prisma.UserFindManyArgs) {
|
||||
return await this.prismaService.user.findMany(params);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user