Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add solution by Faiza Hamid #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# Ignore env config
.env
.env.sample
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this file be here?


# Ignore node_modules
node_modules
Expand All @@ -20,3 +21,4 @@ node_modules
deploy_logs.json

temp
Makefile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you add it to gitignore?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Because I had a problem with push.

16 changes: 16 additions & 0 deletions api/migrations/20240821154350-add-city-to-recruiter-profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn(
'recruiter_profiles', 'city', {
type: Sequelize.STRING(255),
allowNull: true,
},
);
},

down: async (queryInterface, Sequelize) => {
await queryInterface.removeColumn('recruiter_profiles', 'city');
},
};
43 changes: 43 additions & 0 deletions api/seeders/20240827074257-seed-city-column.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 'use strict';

module.exports = {
up: async (queryInterface, Sequelize) => {
const cities = [
'Kyiv',
'Lviv',
'Odessa',
'Kharkiv',
'Dnipro',
'Zaporizhzhia',
'Ivano-Frankivsk',
'Vinnytsia',
'Chernihiv',
'Uzhhorod',
'Ternopil',
'Kherson',
'Rivne',
'Poltava',
'Cherkasy',
'Zhytomyr',
'Sumy',
'Chernivtsi',
'Lutsk',
'Mykolaiv',
];

const profiles = await queryInterface.sequelize.query(
'SELECT id FROM recruiter_profiles',
{ type: Sequelize.QueryTypes.SELECT },
);

const updates = profiles.map((profile) => queryInterface.bulkUpdate(
'recruiter_profiles',
{ city: cities[Math.floor(Math.random() * cities.length)] },
{ id: profile.id },
));

await Promise.all(updates);
},

down: async (queryInterface) => queryInterface.bulkUpdate('recruiter_profiles', { city: null }, {}),
};
10 changes: 7 additions & 3 deletions api/src/graphql/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ export type Scalars = {
Boolean: boolean;
Int: number;
Float: number;
GraphQLDateTime: string;
Upload: any;
GraphQLDateTime: string;
};


export type AdminSettings = {
__typename?: 'AdminSettings';
id: Scalars['Int'];
Expand Down Expand Up @@ -168,6 +169,7 @@ export type MutationCreateRecruiterProfileArgs = {
userId: Scalars['Int'];
position: Scalars['String'];
companyName: Scalars['String'];
city?: Maybe<Scalars['String']>;
};


Expand Down Expand Up @@ -545,6 +547,7 @@ export type MutationUpdateProfileContactsArgs = {
export type MutationUpdateRecruiterProfileArgs = {
position?: Maybe<Scalars['String']>;
companyName?: Maybe<Scalars['String']>;
city?: Maybe<Scalars['String']>;
};


Expand Down Expand Up @@ -994,6 +997,7 @@ export type RecruiterProfile = {
rejectReason?: Maybe<Scalars['String']>;
position?: Maybe<Scalars['String']>;
companyName?: Maybe<Scalars['String']>;
city?: Maybe<Scalars['String']>;
user?: Maybe<User>;
lastActionTime?: Maybe<Scalars['GraphQLDateTime']>;
statusesNotificationSentAt?: Maybe<Scalars['GraphQLDateTime']>;
Expand Down Expand Up @@ -1314,7 +1318,6 @@ export type CandidateProfileWorkPlaceInput = {
endDate?: Maybe<Scalars['GraphQLDateTime']>;
};


export type CandidateProfileFullFragment = (
{ __typename?: 'CandidateProfile' }
& CandidateProfileBaseFragment
Expand Down Expand Up @@ -1549,7 +1552,7 @@ export type JobExperienceBaseFragment = (

export type RecruiterProfileBaseFragment = (
{ __typename?: 'RecruiterProfile' }
& Pick<RecruiterProfile, 'id' | 'status' | 'rejectReason' | 'position' | 'companyName' | 'slug' | 'lastActionTime'>
& Pick<RecruiterProfile, 'id' | 'status' | 'rejectReason' | 'position' | 'companyName' | 'slug' | 'lastActionTime' | 'city'>
);

export type RecruiterProfileFullFragment = (
Expand Down Expand Up @@ -2171,6 +2174,7 @@ export const RecruiterProfileBaseFragmentDoc = gql`
companyName
slug
lastActionTime
city
}
`;
export const RecruiterProfileUserFragmentDoc = gql`
Expand Down
7 changes: 7 additions & 0 deletions api/src/models/RecruiterProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ export class RecruiterProfile extends ModelBase<RecruiterProfile> {
field: 'deleted_at',
})
deletedAt: Date

@AllowNull(true)
@Column({
type: DataType.STRING(255),
field: 'city',
})
city: string | null
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export const RECRUITER_PROFILE_BASE_FRAGMENT = gql`
companyName
slug
lastActionTime
city
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export const RECRUITER_PROFILE_BASE_FRAGMENT = gql`
companyName
slug
lastActionTime
city
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export const RECRUITER_PROFILE_BASE_FRAGMENT = gql`
companyName
slug
lastActionTime
city
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export const RECRUITER_PROFILE_BASE_FRAGMENT = gql`
slug
lastActionTime
statusesNotificationSentAt
city
}
`;
3 changes: 3 additions & 0 deletions api/src/modules/recruiterProfile/recruiterProfile.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ export const RecruiterProfileSchema = gql`
userId: Int!
position: String!
companyName: String!
city: String
): RecruiterProfile!

updateRecruiterProfile(
position: String
companyName: String
city: String
): RecruiterProfile!

sendRecruiterProfileToReview: RecruiterProfile!
Expand Down Expand Up @@ -59,6 +61,7 @@ export const RecruiterProfileSchema = gql`
rejectReason: String
position: String
companyName: String
city: String
user: User
lastActionTime: GraphQLDateTime
statusesNotificationSentAt: GraphQLDateTime
Expand Down
7 changes: 5 additions & 2 deletions cms/src/controllers/graphql/api/api.request.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ export type Scalars = {
Boolean: boolean;
Int: number;
Float: number;
GraphQLDateTime: string;
Upload: any;
GraphQLDateTime: string;
};


export type AdminSettings = {
__typename?: 'AdminSettings';
id: Scalars['Int'];
Expand Down Expand Up @@ -167,6 +168,7 @@ export type MutationCreateRecruiterProfileArgs = {
userId: Scalars['Int'];
position: Scalars['String'];
companyName: Scalars['String'];
city?: Maybe<Scalars['String']>;
};


Expand Down Expand Up @@ -544,6 +546,7 @@ export type MutationUpdateProfileContactsArgs = {
export type MutationUpdateRecruiterProfileArgs = {
position?: Maybe<Scalars['String']>;
companyName?: Maybe<Scalars['String']>;
city?: Maybe<Scalars['String']>;
};


Expand Down Expand Up @@ -993,6 +996,7 @@ export type RecruiterProfile = {
rejectReason?: Maybe<Scalars['String']>;
position?: Maybe<Scalars['String']>;
companyName?: Maybe<Scalars['String']>;
city?: Maybe<Scalars['String']>;
user?: Maybe<User>;
lastActionTime?: Maybe<Scalars['GraphQLDateTime']>;
statusesNotificationSentAt?: Maybe<Scalars['GraphQLDateTime']>;
Expand Down Expand Up @@ -1313,7 +1317,6 @@ export type CandidateProfileWorkPlaceInput = {
endDate?: Maybe<Scalars['GraphQLDateTime']>;
};


export type ReviewCandidateProfileMutationVariables = Exact<{
id: Scalars['Int'];
status: CandidateProfileStatus;
Expand Down
Loading