-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
latest-changes-of-ehsaan-stream #2
base: master
Are you sure you want to change the base?
Conversation
@OneToMany(() => Track, (tracks) => tracks.channel) | ||
tracks: Track; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to have tracks with channel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we will need it. Every channel will have its separate tracks and we will call them accordingly from the api
'Channel not found. Cannot create Tracks', | ||
HttpStatus.BAD_REQUEST, | ||
); | ||
const newTrack = this.trackRepository.create({ | ||
...createTracks, | ||
channel, | ||
}); | ||
return this.trackRepository.save(newTrack); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why create new channel? we just need to insert new track with channelId if channel exists
async login({ name, password }: CreateUserDto) { | ||
const user = await this.userRepository.findOne({where: {name}}); | ||
if (!user) { | ||
throw new HttpException("User not found", HttpStatus.UNAUTHORIZED); | ||
} | ||
|
||
const areEqual = await comparePassword(password, user.password); | ||
|
||
if (!areEqual) { | ||
throw new HttpException("Invalid credentials", HttpStatus.UNAUTHORIZED); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix formatting
async createUser(createUserDto: CreateUserDto) { | ||
try { | ||
const password = encodePassword(createUserDto.password); | ||
const newUser = this.userRepository.create({ ...createUserDto, password }); | ||
await this.userRepository.save(newUser); | ||
return newUser; | ||
|
||
} catch (error) { | ||
throw new InternalServerErrorException(); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be protected, cant have users be created.
export class CreateChannelDto { | ||
englishName: string; | ||
arabicName: string; | ||
channelRoute: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats this route?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every channel will have there unique route.
For Example, Moulana Tariq Jameel route will be @MTJ.
https://ehsaan-stream.web.app/channels/@MTJ
We will call channels with this route. It is a unique column.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok this is the identifier or handle
not route. change to a different name
englishName: string; | ||
arabicName: string; | ||
channelRoute: string; | ||
thumbnail: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this thumbnail path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of storing the full path of the thumbnail in the database, we store only the thumbnail name. We have implemented a new route that retrieves the saved thumbnail file from the file system (fs) and serves it to the user based on the thumbnail name stored in the database.
Here how it works,
const filePath = join(process.cwd(), 'uploads/thumbnails', channel.thumbnail);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets rename to key then
@@ -0,0 +1,4 @@ | |||
export class CreateTrackDto { | |||
name: string; | |||
src: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is mp3 track path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have done same thing for mp3 tracks files what we did for thumbnail files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the src column the name of the mp3 file is stored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets rename to key then
name: 'channelId', | ||
referencedColumnName: 'id', | ||
}) | ||
public channel: Channel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why public
This PR contains all the latest changes of ehsaan stream- BE. Including migration and seeding