VRMS icon indicating copy to clipboard operation
VRMS copied to clipboard

feat: script to clean up backend emails

Open freaky4wrld opened this issue 11 months ago • 7 comments

#1551

What changes did you make and why did you make them ?

  • Added scripts folder, and created a emailCleaner script to convert all the uppercase emails to lowercase
  • Identified the conflicts and merged them as told
  • This only works on the test-data.json also the script is saved in .mjs format to run it on node
  • test-data.json was the file I didn't included in the PR it consists of all the users information and can be created by making a GET request to http://localhost:4000/api/users/ with ThunderClient, then copying the contents to the a new file in the newly created scripts folder

Identified Uppercase emails

Uppercase emails
 [
  {
    name: { firstName: 'Dae', lastName: 'Kim' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5f28c25206f21000177e690a',
    email: '[email protected]',
    currentRole: 'Software Developer',
    desiredRole: 'Frontend Developer',
    newMember: true,
    firstAttended: 'AUG 2020',
    createdDate: '2020-08-04T02:05:06.309Z',
    __v: 0
  },
  {
    name: { firstName: 'Scott', lastName: 'Larsen' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e435ce7ef67e100175c1ee3',
    email: '[email protected]',
    currentRole: 'Student',
    desiredRole: 'Python Developer',
    newMember: true,
    firstAttended: 'JAN 2020',
    createdDate: '2020-02-12T02:03:19.149Z',
    __v: 0,
    attendanceReason: 'Homelessness',
    currentProject: 'Food Oasis'
  },
  {
    name: { firstName: 'sflivnaldf', lastName: 'afbka' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '6101db234815993498437084',
    email: '[email protected]',
    currentRole: 'af',
    desiredRole: 'argfg',
    newMember: true,
    firstAttended: 'JUL 2021',
    createdDate: '2021-07-28T22:33:07.120Z',
    __v: 0
  },
  {
    name: { firstName: 'JASON', lastName: 'YANG' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e38d1568d52770017ae8a86',
    email: '[email protected]',
    currentRole: 'DATA SCIENTIST',
    desiredRole: 'DATA SCIENTIST',
    newMember: false,
    firstAttended: 'SEP 2019',
    createdDate: '2020-02-04T02:05:10.999Z',
    __v: 0
  },
  {
    name: { firstName: 'Jonathon', lastName: 'Dooley' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5f0540b24f31cf00174d7538',
    email: '[email protected]',
    currentRole: 'Student',
    desiredRole: 'Developer',
    newMember: false,
    firstAttended: 'JUL 2020',
    createdDate: '2020-07-08T03:42:42.621Z',
    __v: 0
  },
  {
    name: { firstName: 'Julia', lastName: 'Fong' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [ '5ec326c7a973810017c0de0c', '619af6c86a8afa609cd5c419' ],
    isActive: true,
    _id: '5e435911ef67e100175c1ecb',
    email: '[email protected]',
    currentRole: 'fellow',
    desiredRole: 'front-end developer',
    newMember: true,
    firstAttended: 'JAN 2020',
    createdDate: '2020-02-12T01:46:57.788Z',
    __v: 0
  },
  {
    name: { firstName: 'RYAN', lastName: 'COLLINS' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e38d10a8d52770017ae8a81',
    email: '[email protected]',
    currentRole: 'NONE',
    desiredRole: 'DATA SCIENTIST',
    newMember: true,
    firstAttended: 'JAN 2020',
    createdDate: '2020-02-04T02:03:54.970Z',
    __v: 0
  },
  {
    name: { firstName: 'Chris', lastName: 'Schmitz' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e30ee120b9d2300177d3b38',
    email: '[email protected]',
    currentRole: 'Mobile Engineering Manager',
    desiredRole: 'Mobile Engineering Manager',
    newMember: false,
    firstAttended: 'MAY 2017',
    createdDate: '2020-01-29T02:29:38.664Z',
    __v: 0,
    attendanceReason: 'Civic Engagement',
    currentProject: 'None'
  },
  {
    name: { firstName: 'akib', lastName: 'mohaimenur rahman' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '60d6a4e82e675e4a90e9ca92',
    email: '[email protected]',
    currentRole: 'asdb',
    desiredRole: 'asd',
    newMember: true,
    firstAttended: 'JUN 2021',
    createdDate: '2021-06-26T03:54:16.188Z',
    __v: 0
  },
  {
    name: { firstName: 'test', lastName: 'test' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '6101d94c4815993498437083',
    email: '[email protected]',
    currentRole: 's',
    desiredRole: 's1',
    newMember: true,
    firstAttended: 'JUL 2021',
    createdDate: '2021-07-28T22:25:16.037Z',
    __v: 0
  },
  {
    name: { firstName: 'DAVID', lastName: 'PEASE' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e1d2283316d2f00172ef05a',
    email: '[email protected]',
    currentRole: 'DIRECTOR OF CUSTOMER SUCCESS',
    desiredRole: 'Project Manager',
    newMember: true,
    firstAttended: 'JAN 2020',
    createdDate: '2020-01-14T02:08:03.445Z',
    __v: 0
  },
  {
    name: { firstName: 'ELI', lastName: 'SELKIN' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e7965101e29ad00179399bb',
    email: '[email protected]',
    currentRole: 'ENGAGE LEAD',
    desiredRole: 'ENGAGE LEAD',
    newMember: false,
    firstAttended: 'MAR 2017',
    createdDate: '2020-03-24T01:40:32.576Z',
    __v: 0
  },
  {
    name: { firstName: 'Trillium', lastName: 'Smith' },
    accessLevel: 'admin',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [ '6407a1a8f97d2497a9f09dfa', '640500c62f66fc21b41289a5' ],
    isActive: false,
    _id: '5e965e554e2fc70017aa3970',
    email: '[email protected]',
    currentRole: 'Student',
    desiredRole: 'Full stack or front end development',
    newMember: true,
    firstAttended: 'APR 2020',
    createdDate: '2020-04-15T01:07:33.445Z',
    __v: 0
  },
  {
    name: { firstName: 'Kevin', lastName: 'Howley' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e4c9b59b73a2a001732f487',
    email: '[email protected]',
    currentRole: 'Project Manager',
    desiredRole: 'Project Manager',
    newMember: false,
    firstAttended: 'APR 2019',
    createdDate: '2020-02-19T02:20:09.712Z',
    __v: 0,
    attendanceReason: 'Transportation',
    currentProject: 'TDM Calculator'
  },
  {
    name: { firstName: 'Adam', lastName: 'Kendis' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e27b1e54530cd0017eee431',
    email: '[email protected]',
    currentRole: 'Front End Engineer',
    desiredRole: 'Front End Engineer',
    newMember: true,
    firstAttended: 'JAN 2020',
    createdDate: '2020-01-22T02:22:29.017Z',
    __v: 0
  },
  {
    name: { firstName: 'Jabari', lastName: 'Brown' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: true,
    _id: '5e27abf74530cd0017eee417',
    email: '[email protected]',
    currentRole: 'Project Lead',
    desiredRole: 'Project Lead',
    newMember: false,
    firstAttended: 'NOV 2019',
    createdDate: '2020-01-22T01:57:11.736Z',
    __v: 0
  },
  {
    name: { firstName: 'Aaron', lastName: 'Anderson' },
    accessLevel: 'user',
    skillsToMatch: [],
    projects: [],
    textingOk: false,
    managedProjects: [],
    isActive: false,
    _id: '5e4c995eb73a2a001732f47e',
    email: '[email protected]',
    currentRole: 'backhand',
    desiredRole: 'backhand',
    newMember: true,
    firstAttended: 'JAN 2020',
    createdDate: '2020-02-19T02:11:42.827Z',
    __v: 0
  }
]

freaky4wrld avatar Mar 13 '24 05:03 freaky4wrld

Want to review this pull request? Take a look at this documentation for a step by step guide!

From your project repository, check out a new branch and test the changes.

git checkout -b freaky4wrld-clean-backend-emails-1551 development
git pull https://github.com/freaky4wrld/VRMS.git clean-backend-emails-1551

github-actions[bot] avatar Mar 13 '24 05:03 github-actions[bot]

@Spiteless review the PR it only works on the test-data.json, provide your feedback and resources to execute the same in the database rather than the json file, while executing the script in .js format it was suggesting to convert to .mjs don't know why that happened.

freaky4wrld avatar Mar 13 '24 05:03 freaky4wrld

Can you give me some hints?? Or point me to some resource... I don't fully understand it!!

freaky4wrld avatar Apr 18 '24 09:04 freaky4wrld

I am so sorry for the crappy review above. the fear is that we may have an orphaned record, or zombie data.

definition of orphaned data

"Orphaned data refers to data that is no longer associated with a corresponding record or entity in a database, data storage or other information system. This situation typically arises when a record, file, or object is deleted, but the associated data remains in the system without a proper link to a parent entity. "

The checkin data references the users. and maybe we want to consolidate those checkins the same way you consolidated the rest of the data. We will bring this up in the meeting today and give you a better review.

Again, apologies about the review above

jbubar avatar May 07 '24 01:05 jbubar

Can you create a test-data.json file with dummy data in it?

@jbubar I've added the test-data.json file as required. Review the changes when you are free

freaky4wrld avatar May 11 '24 03:05 freaky4wrld

@jbubar Can you please review this PR when you have a chance?

JackHaeg avatar Jun 11 '24 01:06 JackHaeg

@jbubar Just checking in on this PR - do you think you will have a chance to review soon? If not, we can request a review from @trilliumsmith

JackHaeg avatar Aug 06 '24 04:08 JackHaeg