Skip to content

Commit

Permalink
Merge pull request #21 from Kolektivo-Labs/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
simon0820s authored Dec 20, 2024
2 parents d5c8663 + 9586eb7 commit eb9dc99
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/services/domain/activities.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ActivityType, ImpactDto } from '@/types/activities'
import { ActivityHost } from '@/types/activityHosts'
import { createAnonymousClient } from '@/utils/supabase/anonymousClient'
import { createClient } from '@/utils/supabase/server'
import axios from 'axios'
import { NextResponse } from 'next/server'

const supabaseBucket = process.env.NEXT_PUBLIC_SUPABASE_BUCKET || ''
Expand Down Expand Up @@ -159,10 +161,20 @@ export async function getCompletedActivities(page: number) {

export async function postActivity(newActivity: ActivityType) {
console.log('Creating activity')

const supabaseClient = createAnonymousClient()

const bannerSrc = newActivity.banner_src
delete newActivity.banner_src

const activityHost: ActivityHost = {
id: newActivity.activity_host_id,
name: newActivity.user_created,
wallet_address: 'X'
}
console.log('Creating activity host')
const { data: activityHostData, error: activityHostError } = await supabaseClient.from('activity_hosts').insert([activityHost]).select()
console.log('Error: ', activityHostData)
console.log('ActivityHostData: ', activityHostError)
const { data, error } = await supabaseClient.from(ACTIVITIES).insert([newActivity]).select()
if (error) return NextResponse.json(error)
console.log('Activity created successfully')
Expand Down
5 changes: 5 additions & 0 deletions src/services/domain/activityHosts.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ActivityHost } from "@/types/activityHosts";

export async function createActivityHost(activityHost: ActivityHost) {
console.log(activityHost)
}
5 changes: 5 additions & 0 deletions src/types/activityHosts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type ActivityHost = {
id: string
name: string
wallet_address: string
}

0 comments on commit eb9dc99

Please sign in to comment.