Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/frontend/lib/glob-10…
Browse files Browse the repository at this point in the history
….3.15
  • Loading branch information
DOOduneye committed May 21, 2024
2 parents 3841f07 + 5b96eaa commit 08c91fc
Show file tree
Hide file tree
Showing 203 changed files with 9,523 additions and 11,096 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: "☢️ Bug"
about: Create a report to help us improve
title: "☢️ bug: [Short description of the bug]"
labels: ["☢️ bug"]
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/chore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "🧹 Chore"
about: Something you'd like to see done but not urgently
title: "🧹 chore: [Short description of the chore]"
labels: ["🧹 chore"]
---

**Please describe.**
A clear and concise description of what you'd like to see. Ex. We should [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "📝 Feature Request"
about: Suggest an idea for this project
title: "📝 feat: [Short description of the feature]"
labels: ["📝 feature"]
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
15 changes: 9 additions & 6 deletions .github/workflows/frontend_lib_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ on:
branches:
- main
paths:
- "frontend/lib/**"
- frontend/lib/**

permissions:
contents: read

jobs:
build:
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
scope: '@octocat'
node-version: 20.x
registry-url: https://registry.npmjs.org
scope: "@octocat"
- run: |
cd frontend/lib
yarn
yarn build
NODE_AUTH_TOKEN=${{ secrets.NPM_AUTH_TOKEN }}
yarn publish --access public
NODE_AUTH_TOKEN=${{ secrets.NPM_AUTH_TOKEN }} yarn publish --access public
13 changes: 10 additions & 3 deletions backend/auth/password.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package auth

import (
"errors"
"fmt"
"regexp"
"strings"
Expand All @@ -9,16 +10,22 @@ import (
)

func ValidatePassword(password string) error {
var errs []string

if len(password) < 8 {
return fmt.Errorf("password must be at least 8 characters long")
errs = append(errs, "must be at least 8 characters long")
}

if !hasDigit(password) {
return fmt.Errorf("password must contain at least one digit")
errs = append(errs, "must contain at least one digit")
}

if !hasSpecialChar(password) {
return fmt.Errorf("password must contain at least one special character")
errs = append(errs, fmt.Sprintf("must contain at least one special character from: [%v]", string(constants.SPECIAL_CHARACTERS)))
}

if len(errs) > 0 {
return errors.New(strings.Join(errs, ", "))
}

return nil
Expand Down
24 changes: 24 additions & 0 deletions backend/config/calendar.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package config

import (
"time"
)

type CalendarSettings struct {
MaxTerminationDate time.Time
}

type intermediateCalendarSettings struct {
MaxTerminationDate string `yaml:"maxterminationdate"`
}

func (int *intermediateCalendarSettings) into() (*CalendarSettings, error) {
t, err := time.Parse("01-02-2006", int.MaxTerminationDate)
if err != nil {
return nil, err
}

return &CalendarSettings{
MaxTerminationDate: t,
}, nil
}
24 changes: 16 additions & 8 deletions backend/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@ import (
)

type Settings struct {
Application ApplicationSettings
Database DatabaseSettings
SuperUser SuperUserSettings
Auth AuthSettings
AWS AWSSettings
PineconeSettings PineconeSettings
OpenAISettings OpenAISettings
ResendSettings ResendSettings
Application ApplicationSettings
Database DatabaseSettings
SuperUser SuperUserSettings
Auth AuthSettings
AWS AWSSettings
Pinecone PineconeSettings
OpenAI OpenAISettings
Resend ResendSettings
Calendar CalendarSettings
}

type intermediateSettings struct {
Application ApplicationSettings `yaml:"application"`
Database intermediateDatabaseSettings `yaml:"database"`
SuperUser intermediateSuperUserSettings `yaml:"superuser"`
Auth intermediateAuthSettings `yaml:"authsecret"`
Calendar intermediateCalendarSettings `yaml:"calendar"`
}

func (int *intermediateSettings) into() (*Settings, error) {
Expand All @@ -41,11 +43,17 @@ func (int *intermediateSettings) into() (*Settings, error) {
return nil, err
}

calendarSettings, err := int.Calendar.into()
if err != nil {
return nil, err
}

return &Settings{
Application: int.Application,
Database: *databaseSettings,
SuperUser: *superUserSettings,
Auth: *authSettings,
Calendar: *calendarSettings,
}, nil
}

Expand Down
6 changes: 3 additions & 3 deletions backend/config/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ func readLocal(v *viper.Viper, path string, useDevDotEnv bool) (*Settings, error
return nil, fmt.Errorf("failed to read Pinecone settings: %w", err)
}

settings.PineconeSettings = *pineconeSettings
settings.Pinecone = *pineconeSettings

openAISettings, err := readOpenAISettings()
if err != nil {
return nil, fmt.Errorf("failed to read OpenAI settings: %w", err)
}

settings.OpenAISettings = *openAISettings
settings.OpenAI = *openAISettings

awsSettings, err := readAWSSettings()
if err != nil {
Expand All @@ -63,7 +63,7 @@ func readLocal(v *viper.Viper, path string, useDevDotEnv bool) (*Settings, error
return nil, fmt.Errorf("failed to read Resend settings: %w", err)
}

settings.ResendSettings = *resendSettings
settings.Resend = *resendSettings

return settings, nil
}
10 changes: 6 additions & 4 deletions backend/config/production.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
type ProductionSettings struct {
Database ProductionDatabaseSettings `yaml:"database"`
Application ProductionApplicationSettings `yaml:"application"`
Calendar CalendarSettings `yaml:"calendar"`
}

type ProductionDatabaseSettings struct {
Expand Down Expand Up @@ -118,9 +119,10 @@ func readProd(v *viper.Viper) (*Settings, error) {
AccessKey: authAccessKey,
RefreshKey: authRefreshKey,
},
PineconeSettings: *pineconeSettings,
OpenAISettings: *openAISettings,
AWS: *awsSettings,
ResendSettings: *resendSettings,
Pinecone: *pineconeSettings,
OpenAI: *openAISettings,
AWS: *awsSettings,
Resend: *resendSettings,
Calendar: prodSettings.Calendar,
}, nil
}
6 changes: 5 additions & 1 deletion backend/constants/email.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
package constants

const DOMAIN string = "@generatesac.davidoduneye.com"
const (
DOMAIN string = "@generatesac.davidoduneye.com"
ONBOARDING_EMAIL string = "onboarding" + DOMAIN
DEFAULT_FROM_EMAIL string = "no-reply" + DOMAIN
)
13 changes: 0 additions & 13 deletions backend/constants/pagination.go

This file was deleted.

7 changes: 6 additions & 1 deletion backend/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func CreateSuperUserIfNotExists(settings config.Settings, db *gorm.DB) error {

func createSuperUser(settings config.Settings, db *gorm.DB) error {
tx := db.Begin()
defer func() {
if r := recover(); r != nil {
tx.Rollback()
}
}()

if err := tx.Error; err != nil {
return err
Expand Down Expand Up @@ -144,5 +149,5 @@ func createSuperUser(settings config.Settings, db *gorm.DB) error {
return tx.Commit().Error
}

return nil
return tx.Commit().Error
}
Loading

0 comments on commit 08c91fc

Please sign in to comment.