Giter Club home page Giter Club logo

dwitter's Introduction

Dwitter 馃惁

驴C贸mo correr el proyecto? 馃憖

Pararse en la raiz del proyecto ./Dwitter y en terminal, correr npm install y luego npm start, luego ir a localhost:8080 (Ya que apunta por defecto al puerto 8080)

  • Si aparece en consola el siguiente error TextEncoder is not defined para la dependencia whatwg-url, ir a node_modules/whatwg-url/dist/encoding.js y agregar la linea const { TextEncoder, TextDecoder } = require("util"); en la parte de arriba de todo de este archivo.
  • Este proyecto fue hecho con la version 10 de NodeJS.

Tecnologias

  • Se eligio NodeJS con Express para el backend por la rapidez de desarrollo que brinda. Tambien porque su integracion con Socket.IO es muy simple. 鉁旓笍
  • Se eligio Pug como frontend engine ya que esta basado en Javascript y brinda una sintaxis muy sencilla para HTML, acelerando asi el desarrollo de este proyecto para que nos podamos concentrar puramente en el funcionamiento del backend 鉁旓笍
  • Se eligio MongoDB como Base de Datos. Al ser una base de datos no relacional, se brindaran los Schemas como documentacion. 鉁旓笍
  • Las llamadas a las API se haran con Axios y los Scripts del lado del cliente con JQuery o Javascript Vanilla. Algunas llamadas se har谩n usando AJAX. 鉁旓笍
  • El frontend se complementar谩 con Bootstrap 鉁旓笍

Endpoints

Api Posts /api/posts

  • GET => Obtener posts
  • GET /:id => Obtener post por ID
  • POST => Generar nuevo post
  • PUT /:id/like => Likear post por ID
  • POST /:id/redweet => Redweetear Post
  • DELETE /:id => Eliminar Post por ID
  • PUT /:id => Esta funcion se usa para Pinear/Despinear a los Posts

Api Notifications /api/notifications

  • GET => Obtener notificaciones donde el receptor es el usuario, esto se obtiene por la sesion activa
  • GET /latest => Obtener las ultimas notificaciones sin leer
  • PUT /markAsOpened => Marcar como leida todas las notificaciones
  • PUT /:id/markAsOpened => Marcar como leida una sola notificacion

Api Users /api/users

  • GET => Obtener usuarios
  • PUT /:userId/follow => Seguir a un usuario
  • GET /:userId/siguiendo => Obtener los usuarios que sigue un usuario por ID
  • GET /:userId/seguidores => Obtener los usuarios que siguen a un usuario por ID
  • POST /profilePicture => Subir una foto de perfil
  • POST /coverPhoto => Subir una foto de portada

Api Messages /api/messages

  • POST => Postear un mensaje

Api Chats /api/chats

  • POST => Crear Chat
  • GET / => Obtener Chats
  • GET /:chatId => Obtener un chat en especifico
  • GET /:chatId/messages => Obtener mensajes de un chat
  • PUT /:chatId/messages/markAsRead => Marcar mensajes como leidos
  • PUT /:chatId => Update chat

Schemas

Los mismos pueden variar a medida que se va desarrollando el proyecto

User

    usuario : {
        type: String,
        required: true,
        trim: true,
        unique: true,
    },
    password : {
        type: String,
        required: true,
        trim: false,
    },
    email : {
        type: String,
        required: true,
        trim: true,
        unique: true,
    },
    foto : {
        type: String,
        default: '/images/profileDefault.png'
    },
    fotoPortada: { type: String },
    likes: [{ type: Schema.Types.ObjectId, ref: 'Post' }],
    redweets: [{ type: Schema.Types.ObjectId, ref: 'Post' }],
    siguiendo: [{ type: Schema.Types.ObjectId, ref: 'User' }],
    seguidores: [{ type: Schema.Types.ObjectId, ref: 'User' }]
}, {timestamps: true});
  • Se esta evaluando agregar Nombre o una especie de ShowName para simular el funcionamiento de Twitter, donde el usuario puede modificar su nombre que aparece al lado de su nombre de usuario.

Chat

    nombreChat: { type: String, trim: true },
    esChatGrupal: { type: Boolean, default: false },
    usuarios: [{ type: Schema.Types.ObjectId, ref: 'User' }],
    ultimoMensaje: { type: Schema.Types.ObjectId, ref: 'Message' }
}, { timestamps: true });

Message

 emisor: { type: Schema.Types.ObjectId, ref: 'User' },
    contenido: { type: String, trim: true },
    chat: { type: Schema.Types.ObjectId, ref: 'Chat' },
    leidoPor: [{ type: Schema.Types.ObjectId, ref: 'User' }]
}, { timestamps: true });

Notification

 receptor: { type: Schema.Types.ObjectId, ref: 'User' },
    emisor: { type: Schema.Types.ObjectId, ref: 'User' },
    tipoNotificacion: String,
    visto: { type: Boolean, default: false },
    entityId: Schema.Types.ObjectId
}, { timestamps: true });

Post (O Dwit)

    contenido: { type: String, trim: true },
    autor: { type: Schema.Types.ObjectId, ref: 'User' },
    pinned: Boolean,
    likes: [{ type: Schema.Types.ObjectId, ref: 'User' }],
    redweetsUsers: [{ type: Schema.Types.ObjectId, ref: 'User' }],
    redweetData: { type: Schema.Types.ObjectId, ref: 'Post' },
    respondeA: { type: Schema.Types.ObjectId, ref: 'Post' },
}, { timestamps: true });

UML

dwitter's People

Contributors

denulemos avatar denisselemos avatar

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.