Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/common/src/api/tan-query/users/useUpdateProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ export const useUpdateProfile = () => {
}
}

const { blockHash, blockNumber } = await sdk.users.updateProfile({
const { blockHash, blockNumber } = await sdk.users.updateUser({
userId: Id.parse(currentUserId),
id: Id.parse(currentUserId),
profilePictureFile: metadata.updatedProfilePicture?.file,
coverArtFile: metadata.updatedCoverPhoto?.file,
metadata: userMetadataToSdk(metadata)
Expand Down
40 changes: 12 additions & 28 deletions packages/sdk/src/sdk/api/albums/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import { HashId } from '../../types/HashId'
import { Mood, Genre } from '../generated/default'
import type {
CreatePlaylistRequestBody,
CreateTrackRequestBody,
UpdatePlaylistRequestBody
} from '../generated/default'
import type { UploadPlaylistProgressHandler } from '../playlists/types'
import {
UploadTrackMetadataSchema,
USDCPurchaseConditions
} from '../tracks/types'
import { USDCPurchaseConditions } from '../tracks/types'

// Album request body types that wrap playlist types but use album field names
export type CreateAlbumRequestBody = Omit<
Expand Down Expand Up @@ -135,16 +133,6 @@ export const UploadAlbumMetadataSchema = CreateAlbumMetadataSchema.extend({

export type AlbumMetadata = z.input<typeof UploadAlbumMetadataSchema>

const AlbumTrackMetadataSchema = UploadTrackMetadataSchema.partial({
genre: true,
mood: true,
tags: true,
isStreamGated: true,
streamConditions: true,
isDownloadable: true,
downloadConditions: true
})

export const UpdateAlbumMetadataSchema = UploadAlbumMetadataSchema.partial()
.merge(
z.object({
Expand All @@ -161,21 +149,17 @@ export const UpdateAlbumMetadataSchema = UploadAlbumMetadataSchema.partial()
)
.strict()

export const UploadAlbumSchema = z
.object({
userId: HashId,
imageFile: ImageFile,
metadata: UploadAlbumMetadataSchema,
onProgress: z.optional(z.function()),
/**
* Track metadata is populated from the album if fields are missing
*/
trackMetadatas: z.array(AlbumTrackMetadataSchema),
audioFiles: z.array(AudioFile)
})
.strict()
export const UploadAlbumSchema = z.object({
userId: HashId,
imageFile: ImageFile,
onProgress: z.optional(z.function()),
audioFiles: z.array(AudioFile)
})

export type UploadAlbumRequest = z.input<typeof UploadAlbumSchema>
export type UploadAlbumRequest = z.input<typeof UploadAlbumSchema> & {
metadata: CreateAlbumRequestBody
trackMetadatas: CreateTrackRequestBody[]
}

export const UpdateAlbumSchema = z
.object({
Expand Down
Loading
Loading