This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"dev:css": "postcss styles --base styles --dir app/styles -w", | |
"build:css": "postcss styles --base styles --dir app/styles --env production", | |
"dev": "concurrently \"npm run dev:css\" \"remix dev\"", | |
"build": "npm run build:css && remix build" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
plugins: [ | |
require('postcss-import'), | |
require('tailwindcss'), | |
require('autoprefixer'), | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Permissions } from "~/types/team"; | |
import { db, enforcer } from "./db.server"; | |
export const findPermissionInAnObj = async ({ user_id, obj }) => { | |
//find teams in which he is a member | |
const teams = await db.usersOnTeams.findMany({ | |
where: { | |
user_id: user_id, | |
}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ActionFunction, json, redirect } from "remix"; | |
import { db, enforcer } from "~/utils/db.server"; | |
import { AuthActionData } from "~/types/auth"; | |
import { authSchema } from "~/validations"; | |
import { TeamMemberRoles } from "~/types/team"; | |
const badRequest = (data: AuthActionData) => json(data, { status: 400 }); | |
export const action: ActionFunction = async ({ request }) => { | |
const form = await request.formData(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const badRequest = (data: LoginActionData) => json(data, { status: 400 }); | |
const loginSchema = yup.object().shape({ | |
email: yup | |
.string() | |
.email("Email must be a valid email") | |
.required("Email is required"), | |
password: yup.string().required("Password is required"), | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
repositoryformatversion = 0 | |
filemode = true | |
bare = false | |
logallrefupdates = true | |
sshCommand = ssh -i ~/.ssh/denmark_rsa -F /dev/null | |
[user] | |
name = dipesh | |
email = [email protected] | |
[remote "origin"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[request_definition] | |
r = sub, obj, act | |
[policy_definition] | |
p = sub, obj, act | |
[role_definition] | |
g = _, _ | |
[policy_effect] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func HashPassword(pass *string) { | |
bytePass := []byte(*pass) | |
hPass, _ := bcrypt.GenerateFromPassword(bytePass, bcrypt.DefaultCost) | |
*pass = string(hPass) | |
} | |
func ComparePassword(dbPass, pass string) bool { | |
return bcrypt.CompareHashAndPassword([]byte(dbPass), []byte(pass)) == nil | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (h userController) SignInUser(ctx *gin.Context) { | |
var user model.User | |
if err := ctx.ShouldBindJSON(&user); err != nil { | |
ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) | |
} | |
dbUser, err := h.userRepo.GetByEmail(user.Email) | |
if err != nil { | |
ctx.JSON(http.StatusInternalServerError, gin.H{"msg": "No Such User Found"}) | |
return |