Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
chore: image -> image_url
Browse files Browse the repository at this point in the history
  • Loading branch information
ojeytonwilliams committed Sep 20, 2021
1 parent 20f2093 commit eb29466
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 24 deletions.
6 changes: 3 additions & 3 deletions client/graphql.schema.json
Expand Up @@ -510,7 +510,7 @@
"deprecationReason": null
},
{
"name": "image",
"name": "image_url",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -976,7 +976,7 @@
"deprecationReason": null
},
{
"name": "image",
"name": "image_url",
"description": null,
"args": [],
"type": {
Expand Down Expand Up @@ -2958,7 +2958,7 @@
"deprecationReason": null
},
{
"name": "image",
"name": "image_url",
"description": null,
"type": {
"kind": "SCALAR",
Expand Down
3 changes: 3 additions & 0 deletions client/next-env.d.ts
@@ -1,3 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
10 changes: 5 additions & 5 deletions client/src/generated/graphql.tsx
Expand Up @@ -61,7 +61,7 @@ export type CreateEventInputs = {
chapterId: Scalars['Int'];
description: Scalars['String'];
ends_at: Scalars['DateTime'];
image: Scalars['String'];
image_url: Scalars['String'];
invite_only?: Maybe<Scalars['Boolean']>;
name: Scalars['String'];
start_at: Scalars['DateTime'];
Expand Down Expand Up @@ -100,7 +100,7 @@ export type Event = {
description: Scalars['String'];
ends_at: Scalars['DateTime'];
id: Scalars['Int'];
image: Scalars['String'];
image_url: Scalars['String'];
invite_only: Scalars['Boolean'];
name: Scalars['String'];
rsvps: Array<Rsvp>;
Expand Down Expand Up @@ -325,7 +325,7 @@ export type UpdateEventInputs = {
capacity?: Maybe<Scalars['Float']>;
description?: Maybe<Scalars['String']>;
ends_at?: Maybe<Scalars['DateTime']>;
image?: Maybe<Scalars['String']>;
image_url?: Maybe<Scalars['String']>;
invite_only?: Maybe<Scalars['Boolean']>;
name?: Maybe<Scalars['String']>;
start_at?: Maybe<Scalars['DateTime']>;
Expand Down Expand Up @@ -607,7 +607,7 @@ export type EventQuery = {
capacity: number;
start_at: any;
ends_at: any;
image: string;
image_url: string;
chapter: { __typename?: 'Chapter'; id: number; name: string };
tags?: Maybe<Array<{ __typename?: 'Tag'; id: number; name: string }>>;
venue?: Maybe<{
Expand Down Expand Up @@ -1432,7 +1432,7 @@ export const EventDocument = gql`
capacity
start_at
ends_at
image
image_url
chapter {
id
name
Expand Down
Expand Up @@ -22,9 +22,9 @@ export const fields: Field[] = [
placeholder: '',
},
{
key: 'image',
key: 'image_url',
type: 'text',
label: 'Event image',
label: 'Event Image Url',
placeholder: 'https://www.example.image/url',
},
{
Expand Down Expand Up @@ -71,7 +71,7 @@ export interface EventFormData {
name: string;
description: string;
url?: string | null;
image: string;
image_url: string;
video_url?: string | null;
capacity: number;
tags: string;
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/dashboard/Events/graphql/queries.ts
Expand Up @@ -37,7 +37,7 @@ export const EVENT = gql`
capacity
start_at
ends_at
image
image_url
chapter {
id
name
Expand Down
5 changes: 3 additions & 2 deletions client/src/modules/dashboard/Events/pages/EventPage.tsx
Expand Up @@ -56,9 +56,10 @@ export const EventPage: NextPage = () => {

{data.event.canceled && <Heading color="red.500">Canceled</Heading>}
<Text>{data.event.description}</Text>
{data.event.image && (
{data.event.image_url && (
<Text>
Event Image: <a href={data.event.image}>{data.event.image}</a>
Event Image Url:{' '}
<a href={data.event.image_url}>{data.event.image_url}</a>
</Text>
)}
{data.event.url && (
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/dashboard/events.js
Expand Up @@ -31,13 +31,13 @@ describe('events dashboard', () => {
startAt: '2022-01-01T00:01',
endAt: '2022-01-02T00:02',
venueId: '1',
image: 'https://test.event.org/image',
imageUrl: 'https://test.event.org/image',
};
cy.visit('/dashboard/events');
cy.get('a[href="/dashboard/events/new"]').click();
cy.findByRole('textbox', { name: 'Event title' }).type(fix.title);
cy.findByRole('textbox', { name: 'Description' }).type(fix.description);
cy.findByRole('textbox', { name: 'Event image' }).type(fix.image);
cy.findByRole('textbox', { name: 'Event Image Url' }).type(fix.imageUrl);
cy.findByRole('textbox', { name: 'Url' }).type(fix.url);
cy.findByRole('textbox', { name: 'Video Url' }).type(fix.videoUrl);
cy.findByRole('textbox', { name: 'Capacity' }).type(fix.capacity);
Expand Down
2 changes: 1 addition & 1 deletion server/db/generator/factories/events.factory.ts
Expand Up @@ -45,7 +45,7 @@ const createEvents = async (
start_at,
ends_at: addHours(start_at, random(5)),
user_roles: [],
image: image.imageUrl(640, 480, 'nature', true),
image_url: image.imageUrl(640, 480, 'nature', true),
});

await event.save();
Expand Down
13 changes: 13 additions & 0 deletions server/db/migrations/1632132998306-RenameImageToImageURL.ts
@@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class RenameImageToImageURL1632132998306 implements MigrationInterface {
name = 'RenameImageToImageURL1632132998306';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "public"."events" RENAME COLUMN "image" TO "image_url"`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "public"."events" RENAME COLUMN "image_url" TO "image"`);
}
}
4 changes: 2 additions & 2 deletions server/src/controllers/Events/inputs.ts
Expand Up @@ -37,7 +37,7 @@ export class CreateEventInputs {
invite_only: boolean;

@Field(() => String)
image: string;
image_url: string;
}

@InputType()
Expand Down Expand Up @@ -73,5 +73,5 @@ export class UpdateEventInputs {
invite_only: boolean;

@Field(() => String, { nullable: true })
image: string;
image_url: string;
}
2 changes: 1 addition & 1 deletion server/src/controllers/Events/resolver.ts
Expand Up @@ -227,7 +227,7 @@ To add this event to your calendar(s) you can use these links:
event.start_at = new Date(data.start_at) ?? event.start_at;
event.ends_at = new Date(data.ends_at) ?? event.ends_at;
event.capacity = data.capacity ?? event.capacity;
event.image = data.image ?? event.image;
event.image_url = data.image_url ?? event.image_url;

if (data.venueId) {
const venue = await Venue.findOne(data.venueId);
Expand Down
8 changes: 4 additions & 4 deletions server/src/models/Event.ts
Expand Up @@ -92,7 +92,7 @@ export class Event extends BaseModel {

@Field(() => String)
@Column({ nullable: false })
image!: string;
image_url!: string;

constructor(params: {
name: string;
Expand All @@ -108,7 +108,7 @@ export class Event extends BaseModel {
chapter: Chapter;
invite_only?: boolean;
user_roles: UserEventRole[];
image: string;
image_url: string;
}) {
super();
if (params) {
Expand All @@ -126,7 +126,7 @@ export class Event extends BaseModel {
chapter,
invite_only,
user_roles,
image,
image_url,
} = params;

this.name = name;
Expand All @@ -142,7 +142,7 @@ export class Event extends BaseModel {
this.chapter = chapter;
this.invite_only = invite_only || false;
this.user_roles = user_roles;
this.image = image;
this.image_url = image_url;
}
}
}

0 comments on commit eb29466

Please sign in to comment.