Giter Site home page Giter Site logo

strapi's People

Contributors

alearm246 avatar alicefate avatar chungthuang avatar dahuang37 avatar dependabot[bot] avatar dev-launchers-flux avatar dev-launchers-sandbox avatar enjoy2live avatar fluxcdbot avatar hredhya avatar jiawen195 avatar joelcmk avatar kuikuigaoayata avatar mu113r avatar pyxld-kris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

strapi's Issues

remove member's emails from project response and sanitize the response before sending it to the frontend

Details

If you go to api/project/controllers, you'll find two functions called find and findOne. These are also known as controllers. Here's the link That explains what controllers are. You'll see that the two controllers return the member's emails in the response.

When you make a GET request to http://localhost:1337/projects, it'll call the find controller, and you'll get this response.

 [
  {
    "id": 1,
    "slug": "dummyProject",
    "catchPhrase": "awdawd",
    "title": "awdawdawd",
    "vision": "awdawd",
    "Description": null,
    "commitmentLevel": "awdawd",
    "signupFormUrl": "awdawdawd",
    "published_at": "2021-07-14T03:33:29.251Z",
    "created_by": {
      "id": 1,
      "firstname": "Alejandro",
      "lastname": "Armas",
      "username": null,
      "email": "[email protected]",
      "password": "$2a$10$XHAts4.oNR2K7HzjpXgJvO4rEopSVIo3ND/6SnSz3Re39geLIdx6e",
      "resetPasswordToken": null,
      "registrationToken": null,
      "isActive": true,
      "blocked": null,
      "preferedLanguage": null
    },
    "updated_by": {
      "id": 1,
      "firstname": "Alejandro",
      "lastname": "Armas",
      "username": null,
      "email": "[email protected]",
      "password": "$2a$10$XHAts4.oNR2K7HzjpXgJvO4rEopSVIo3ND/6SnSz3Re39geLIdx6e",
      "resetPasswordToken": null,
      "registrationToken": null,
      "isActive": true,
      "blocked": null,
      "preferedLanguage": null
    },
    "created_at": "2021-07-03T20:03:55.687Z",
    "updated_at": "2021-07-14T03:33:29.321Z",
    "description": "qwerqwertq34twergfhsrthdsfth",
    "user": null,
    "meetingLinkURLs": [
      {
        "id": 1,
        "roomName": "Room 8",
        "url": "https://devlaunchers.com/hangout"
      }
    ],
    "meetingTimes": [
      {
        "id": 1,
        "title": "123",
        "date": null,
        "dateTime": "awdawdawd"
      }
    ],
    "keywords": [
      {
        "id": 1,
        "keyword": "1234123123123"
      },
      {
        "id": 2,
        "keyword": "234234234234"
      }
    ],
    "projectReferenceURLs": [
      {
        "id": 1,
        "title": "123qwerwsefwer",
        "url": "234qe3rwytwretywetry"
      }
    ],
    "openPositions": [],
    "team": {
      "id": 1,
      "leaders": [
        {
          "id": 89,
          "name": "alearm246",
          "email": "[email protected]",
          "role": "Backend Developer"
        }
      ],
      "members": [
        {
          "id": 87,
          "name": "test user",
          "email": "[email protected]",
          "role": "Backend Developer"
        },
        {
          "id": 90,
          "name": "new user",
          "email": "[email protected]",
          "role": "System Admin"
        }
      ]
    },
    "Images": [
      {
        "id": 1,
        "image": []
      }
    ],
    "heroImage": {
      "id": 1,
      "name": "cool-backend.jpg",
      "alternativeText": "",
      "caption": "",
      "width": 1250,
      "height": 735,
      "formats": {
        "large": {
          "ext": ".jpg",
          "url": "/uploads/large_cool_backend_ca64adb449.jpg",
          "hash": "large_cool_backend_ca64adb449",
          "mime": "image/jpeg",
          "name": "large_cool-backend.jpg",
          "path": null,
          "size": 57.29,
          "width": 1000,
          "height": 588
        },
        "small": {
          "ext": ".jpg",
          "url": "/uploads/small_cool_backend_ca64adb449.jpg",
          "hash": "small_cool_backend_ca64adb449",
          "mime": "image/jpeg",
          "name": "small_cool-backend.jpg",
          "path": null,
          "size": 17.92,
          "width": 500,
          "height": 294
        },
        "medium": {
          "ext": ".jpg",
          "url": "/uploads/medium_cool_backend_ca64adb449.jpg",
          "hash": "medium_cool_backend_ca64adb449",
          "mime": "image/jpeg",
          "name": "medium_cool-backend.jpg",
          "path": null,
          "size": 35.15,
          "width": 750,
          "height": 441
        },
        "thumbnail": {
          "ext": ".jpg",
          "url": "/uploads/thumbnail_cool_backend_ca64adb449.jpg",
          "hash": "thumbnail_cool_backend_ca64adb449",
          "mime": "image/jpeg",
          "name": "thumbnail_cool-backend.jpg",
          "path": null,
          "size": 5.5,
          "width": 245,
          "height": 144
        }
      },
      "hash": "cool_backend_ca64adb449",
      "ext": ".jpg",
      "mime": "image/jpeg",
      "size": 86.73,
      "url": "/uploads/cool_backend_ca64adb449.jpg",
      "previewUrl": null,
      "provider": "local",
      "provider_metadata": null,
      "created_by": 1,
      "updated_by": 1,
      "created_at": "2021-07-14T03:29:47.066Z",
      "updated_at": "2021-07-14T03:29:47.088Z"
    }
  }
]

If you go to the members section you'll see that it returns the member's email

{
          "id": 87,
          "name": "test user",
          "email": "[email protected]",
          "role": "Backend Developer"
},

All you'll have to do is remove the email from the member in both the find and findOne controller since we don't want to return the member's email. You'll also want to use the sanitizeEntity function to remove all private fields about a project before sending it off to the frontend.

``

Understand who are the contributors for each project

Background

Project leads want a way to understand engagement from each member. Potential sponsors and contributors also want to know level of activities for the project. This can be quantified as the contributions on Github and hours spent in meetings and coworking rooms.

Implementation

Create a contributor component to track the minutes a user spent in meetings and coworking rooms, and optionally include contributions on Github if the project has a Github URL. Add a relational field to project collection to track all contributors.

Allow users to link their discord accounts

Background

We want to allow users to be able to link their discord accounts to their profiles.

Details

Whenever users click on the discord logo when they signup, it will take them to a user consent screen with this link https://discord.com/api/oauth2/authorize?client_id=815294711983112194&redirect_uri=http%3A%2F%2Flocalhost%3A1337%2Fauth%2Fdiscord%2Fcallback&response_type=code&scope=identify screen where they can allow devlaunchers to get basic discord information such as their discord id, avatar, username, and discriminator.

After clicking yes, it will redirect the user back to our servers using a redirect URL that we defined. For instance, in the link I posted above you can see that there is a redirect URL redirect_uri=https%3A%2F%2Fapi-staging.devlaunchers.com%2Fusers%2Fauth%2Fdiscord%2Fcallback. This lets discord know where to send them back. This redirect URL will then call the /auth/discord/callback endpoint which will then fire your controller.

Requirements

  1. get discord information such as discord id, username, avatar, and discriminator
  2. update the current user with their discord information
  3. After updating the user, check if the current user doesn't have a username if not redirect them back to /signup. However, if they do redirect them to /user-profile on the frontend

References

  1. This link talks about how to authenticate through discord

Collect github statistics about a project

Background

We want to display activities about a project to get potential sponsors and contributors excited. One category of activities is github statistics

Details

Github provides APIs to fetch statistics
https://docs.github.com/en/rest/reference/repos#statistics
For example

curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/repos/dev-launchers/platform__website/stats/code_frequency

Returns the weekly aggregate of the number of additions & deletions pushed to https://github.com/dev-launchers/platform__website.
Github also has APIs to query issues https://docs.github.com/en/rest/reference/issues#list-repository-issues

Requirements

We want to build an API that queries the Github API and return the following statistics

  1. Commits in the last year: We can query https://docs.github.com/en/rest/reference/repos#get-the-last-year-of-commit-activity to count commits made in the last year
  2. Contributors and their commits: We can query https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity to list contributors by their Github user URL and commits count
  3. Issues: We can query https://docs.github.com/en/rest/reference/issues#list-repository-issues to count pull requests, open issues and closed issues.

setup relationship between the google meet and its respective project when the google meets collection gets created.

Background

Now that we have the one-to-one relationship between the google meets collection and the project's collection. We need to actually utilize it.

Requirements

In api/google-manager/services/google-manager.js, you'll see a method called createEvent. In that method, we create the google meets entry into the google meets collection for that respective project. You're goal is pass in the id of the project to setup that relationship between the project and the google meets.

Integrate projects with Google Group and Calendar

Background

Each project should have a Google Group to enable

  1. Send emails to the entire group
  2. Create project calendar and share it to the group
  3. Allow members to automatically Join Google Meet

Details

Google Groups can be created via https://developers.google.com/admin-sdk/directory/reference/rest/v1/groups/insert API.
Google Calendars can be created via https://developers.google.com/calendar/api/v3/reference/calendars/insert?authuser=3
After a calendar is created, we can give a Google Group access to it by granting writer ACL to this group https://developers.google.com/calendar/api/v3/reference/acl/insert?authuser=3
Then we can create recurring events using https://developers.google.com/calendar/api/v3/reference/events/insert
A sample request body is

{
  "end": {
    "date": "2021-07-04"
  },
  "start": {
    "date": "2021-07-04"
  },
  "attendees": [
    {
      "email": "[email protected]",
      "responseStatus": "accepted"
    }
  ],
  "recurrence": [
    "RRULE:FREQ=DAILY"
  ],
  "conferenceData": {
    "createRequest": {
      "conferenceSolutionKey": {
        "type": "hangoutsMeet"
      },
      "requestId": "Platform Dev Common Room"
    }
  },
  "summary": "Platform Dev Common Room"
}

Requirements

When a new project is created, the following resources are also created

  1. A Google Group with the project leader as the owner of the group
  2. A project calendar and the Google Group will have write access
  3. A common room as a recurring calendar event and a Google Meet room. The Google Group will be invited automatically

make it so users write one username with no spaces

Problem

If users enter a username with a space then someone tries to view their profile by typing it in the URL, it won't work because a white space will be URL encoded into %20.

Requirement

Make it so whenever someone makes their username we remove all white space and replace them with underscores

You'll want to be using the beforeCreate lifecycle method for the user collection to prevent white space from being in the username and replace it with underscores.
create a file in extensions/users-permissions/models called User.js and you should be able to use the beforeCreate lifecycle method to complete this task.

Resources

If you need a reference here's one reference

implement parent projects and sub projects

Background

We want projects to be able to have sub-projects. For example, the devlaunchers-platform project is the parent project to the site-backend project.

Details

To achieve this you'll create a new one-to-many relationship field between parent projects and sub-projects. This will allow parent projects to have many sub-projects and sub-projects to have one parent project.

Requirements

  • create a one-to-many relationship field inside of the projects collection.
  • make sure it looks like this
    image

Give users points based on time spent in labs

Background

We want to encourage users to create a profile and join Saturday labs or other projects. The strapi server has a cron job to periodically fetch Google meet reports. We can parse the report and give users points for each hour spent in labs/projects.

Requirement

Extend Point collection to track participation minutes of each project. Increment total points and total seasonal points for each hour spent in projects. The hour can come from minutes spent in different projects.

create interests collection

Details

Create a new collection in strapi called interest. This collection will have a one-to-many relationship with the users collection. Right now it should only have one field called interest that should be short text.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.